Collation Error

  • How do i resolve collation errors.

    Msg 468, Level 16, State 9, Line 23

    Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "Latin1_General_CI_AS" in the equal to operation.

    I am getting this error when performing sql statement with inner join and group by clause.

  • The problem is probably related to the tables in the inner join having different collations. Or at least on the columns that you are joining.

    Do an sp_help on the two tables and look at the columns you are joining on. Specifically, look at the collation for these columns.

    To get around the problem you could use the COLLATE option with the CAST statement to change the collation of one of the columns within the join itself. But this might not be ideal because it will result in a scan.

    Ideally you'd determine why the collations are different, and if possible then make the collations match.

  • Are you join temp tables with your regular tables?

  • The most common reason for this kind of error, is when your database has a collation that is different from the server's default collation, and the query generates tempdb activity.

    In that case, the table(s) in the praticular db has no collation issues, but since tempdb has the collation of the server (which then is different), conflicts may arise.

    /Kenneth

Viewing 4 posts - 1 through 3 (of 3 total)

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