Doing a join across two databases with different collations on SQL Server and getting an error

前端 未结 2 676
忘了有多久
忘了有多久 2021-01-30 08:32

I know, I know with what I wrote in the question I shouldn\'t be surprised. But my situation is slowly working on an inherited POS system and my predecessor apparently wasn\'t

2条回答
  •  太阳男子
    2021-01-30 09:06

    You can use the collate clause in a query (I can't find my example right now, so my syntax is probably wrong - I hope it points you in the right direction)

    select sone_field collate SQL_Latin1_General_CP850_CI_AI
      from table_1
        inner join table_2
          on (table_1.field collate SQL_Latin1_General_CP850_CI_AI = table_2.field)
      where whatever
    

提交回复
热议问题