SQL Server报错Chinese_PRC_90_CI_AS

SQL Server 2005报了这么个错:Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "Chinese_PRC_90_CI_AS" in the like operation.

后查证,这是由于两个做比较的列的排序方式不同,中文有很多种排序方式,对应如下:

中文(香港特别行政区)

Chinese_Hong_Kong_Stroke_90_CI_AS

中文(香港特别行政区)

Chinese_Hong_Kong_Stroke_90_CI_AS

中文(澳门特别行政区)

Chinese_PRC_90_CI_AS

中文(中国)

Chinese_PRC_CI_AS

中文(中国)

Chinese_PRC_Stroke_CI_AS

中文(新加坡)

Chinese_PRC_90_CI_AS

中文(台湾)

Chinese_Taiwan_Stroke_CI_AS

中文(台湾)

Chinese_Taiwan_Bopomofo_CI_AS

修正错误只需要在列名后面加上“COLLATE Chinese_PRC_CI_AS”就可以了,例如:

select * from table1, table2

where table1.column1 COLLATE Chinese_PRC_CI_AS=table2.column2 COLLATE Chinese_PRC_CI_AS

你可能感兴趣的:(DB)