Search code examples
sql-serversql-server-2008collationnvarchar

2 different collations conflict when merging tables with Sql Server?


I have DB1 which has a Hebrew collation

I also have DB2 which has latin general collation.

I was asked to merge a table (write a query) between DB1.dbo.tbl1 and DB2.dbo.tbl2

I could write in the wuqery

insert into ...SELECT Col1 COLLATE Latin1_General_CI_AS...

But I'm sick of doing it.

I want to make both dbs/tables to the same collation so I don't have to write every time COLLATE...

The question is -

Should I convert latin->hebrew or Hebrew->latin ?

we need to store everything from everything. ( and all our text column are nvarachr(x))

And if so , How do I do it.


Solution

  • If you are using Unicode data types in resulted database - nvarchar(x), then you are to omit COLLATE in INSERT. SQL Server will convert data from your source collation to Unicode automatically. So you should not convert anything if you are inserting to nvarchar column.