SQL Error: Cannot resolve the collation conflict between "SQL_Latin1_General_

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Uncle Dickie
    New Member
    • Nov 2008
    • 67

    SQL Error: Cannot resolve the collation conflict between "SQL_Latin1_General_

    Hi All,

    I am getting the error:
    Cannot resolve the collation conflict between "SQL_Latin1_Gen eral_CP1_CI_AS" and "Latin1_General _CI_AS" in the equal to operation.
    when I run a query I have written.

    The SQL I have written is pretty long (I can post it if needed but don't want to confuse things too much!), but basically it goes something like this:

    Create temporary table #temp1.
    Insert Into #temp1 (x 2)
    Do some grouping and create (SELECT INTO) new temp table #temp2
    New query joins to #temp2 on a field called PartNumber

    Having read a few things I guess it is a problem with the table I create originally and that I need to have different 'Collate' settings for this column. How would I go about setting this in the CREATE table section of my code or am I going in the wrong direction?

    Any help is appreciated
  • Uncle Dickie
    New Member
    • Nov 2008
    • 67

    #2
    Panic over!

    I found what was needed; adding the COLLATE is done when creating the column

    Code:
    CREATE TABLE #temp1 (OrigPartUK nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS)

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      If you find a situation that you can no longer re-create any tables nor your queries, add a COLLATE 'collation name' on every string comparison in your query, i.e. where and join conditions.

      --- CK

      Comment

      Working...