Odd error on join or lookup

  • I was trying to do a simple join between two tables on a varchar field on same database and I get this error

    Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "SQL_Latin1_General_Pref_CP1_CI_AS" in the equal to operation.

  • Hi there,

    That means that the columns that your joining have diferente collations. Use COLLATE to specify the collation to use in the join.

    José Cruz

  • Do you really need to have different collations for the columns, that may have been an error when setting up the tables. look at the table structures and it may make sense to correct this or it will happen again.

  • The collation on all servers involved is the same

  • There is a default collation for the server.

    There is a default collation for the database (which defaults to the collation for the server)

    The default collation for the database will be applied to any column you add to a table UNLESS you explicitly specify a collation at the column level.

    If the collation for a column is different to the collation of another column you will get a collation error

  • Still all the same, in fact one of the tables was from a linked server, checked the settings for that, still all the same. All at same SP level.

  • Hi there,

    Could you post the scripts for the two tables you're tryiung to link?

    In SSMS you can produce a script that includes collation settings, by right clicking the database, choose Tasks->Generate Scripts, then in the "Choose Script Options" make sure you change the "Script Collation" option to true.

    José Cruz

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply