[ACCEPTED]-How can I resolve my collation conflict in a better way?-collation

Accepted answer
Score: 11

I've seen this where the tempdb has a different 3 default colation than your database, and 2 I needed to add "COLLATE DATABASE_DEFAULT" to 1 my comparisons e.g.

Create table #tmp
(
      mailbox varchar(50) not null
)
 . . .
Select t.mailbox, count(*)
from #tmp t inner join processed_email e
on t.mailbox = e.mailbox

becomes

Select t.mailbox, count(*)
from #tmp t inner join processed_email e
on t.mailbox COLLATE DATABASE_DEFAULT = e.mailbox COLLATE DATABASE_DEFAULT
Score: 0

Binary Worrier's solution is useful for 7 running code with different collations. For 6 example, temp tables and temp variables 5 use the tempdb collation.

To change the collation, MS 4 put together a KB "How to transfer a database from one collation to another collation in SQL Server". It still 3 mentions using DTS though, which may not 2 be possible. I can't find an updated KB 1 article.

More Related questions