同事叫我执行一条sql语句,这个语句是通过一台sql server服务器连接过去的,执行语句如下:
select distinct a.username,b.username personname from gpinfo..V_GPResult a,reporting..reporting b
where b.employeeid = SUBSTRING(a.username,6,10)
消息 468,级别 16,状态 9,第 2 行
无法解决 equal to 运算中 "SQL_Latin1_General_CP1_CI_AS" 和 "Chinese_PRC_CI_AS" 之间的排序规则冲突。
发现报错,从官网上获知,这是排序规则问题,需要加上COLLATE DATABASE_DEFAULT
解决方法,使用数据库默认排序
select distinct a.username,b.username personname from gpinfo..V_GPResult a,reporting..reporting b
where b.employeeid = SUBSTRING(a.username,6,10) COLLATE DATABASE_DEFAULT
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29371470/viewspace-1122750/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29371470/viewspace-1122750/