In MS SQLSERVER, When you try to concatenate, compare, make joins on columns (defined with different collations), you will get the following error message:
Cannot resolve collation conflict for column 1 in SELECT statement.
In MS SQLSERVER, collation can be set at column level. You can resolve the issue in different ways :
Cannot resolve collation conflict for column 1 in SELECT statement.
In MS SQLSERVER, collation can be set at column level. You can resolve the issue in different ways :
- Define same collation for each column in the subject query (Right click TableName > Design/Modify > Select Column > set Collation property in TableDesigner section of Column Properties pane).
- Place COLLATE DATABASE_DEFAULT after each column name used in the query.
e.g.
SELECT TOP 1 FirstName COLLATE DATABASE_DEFAULT + ' ' + LastName COLLATE DATABASE_DEFAULT + ' ' + Email COLLATE DATABASE_DEFAULT + ' ' FROM [User]
- Place COLLATE DATABASE_DEFAULT after select clause, but before from clause.
e.g.
SELECT TOP 1 FirstName + ' ' + LastName + ' ' + Email + ' ' COLLATE DATABASE_DEFAULT FROM [User]
That was helpful. Thanks a lot.
ReplyDeletenice
ReplyDeleteThanks Noufaltm. Glad you liked it.
Delete