How to set collation for a connection in SQL Server?

情到浓时终转凉″ 提交于 2019-11-29 06:14:27

As marc_s commented, the collation is a property of a database or a column, and not of a connection.

However, you can override the collation on statement level using the COLLATE keyword.

Using your examples:

SELECT * FROM Orders
WHERE CustomerID = 3277 
AND ProjectName COLLATE Chinese_PRC_CI_AI_KS_WS LIKE N'學校'

UPDATE Quotes
SET IsCompleted = 1
WHERE QuoteName COLLATE Chinese_PRC_CI_AI_KS_WS = N'學校的操場'

Still, I cannot find a statement on using COLLATE with a dynamic collation name, leaving as only possible solution dynamic SQL and EXEC. See this social.MSDN entry for an example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!