高分求救:排序规则冲突的问题

yarrowch 2005-04-06 09:04:49
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot resolve collation conflict for equal to operation.

SQL Sstatement "delete * from A not exists (select * from B where A.supplier=B.supplier and A.invoice=B.invoice)"
以上语句再有的SQL上执行正常,有的却不正常,查看了表A和B的排序规则,都是database default: Windows collation的Chinese_PRC,请问究竟是哪里的问题?多谢
...全文
155 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
TigerSuper 2005-04-06
  • 打赏
  • 举报
回复
语法没有什么错误
如果是排序规则不统一
可以在连接的时候指定排序规则
A.supplier COLLATE 排序规则名 =B.supplier and A.invoice COLLATE 排序规则名 =B.invoice
铁歌 2005-04-06
  • 打赏
  • 举报
回复
从sql 查询分析器导出该两表的create table ddl语句再比较supplier,invoice
两者的排序规则是否一致,也就是说光看dagta
yarrowch 2005-04-06
  • 打赏
  • 举报
回复
语句是我敲错了
delete from A where not exists (select * from B where A.supplier=B.supplier and A.invoice=B.invoice
talantlee 2005-04-06
  • 打赏
  • 举报
回复
你得語句結構是這樣 delete 表1 from 表2 即使你上面沒語法錯誤,你這樣也隻是把整個表數據刪除
而不是想要得A.supplier=B.supplier and A.invoice=B.invoice相等得才刪除
你可以用
delete ll from A ll,B RR where A.supplier=B.supplier and A.invoice=B.invoice
yesyesyes 2005-04-06
  • 打赏
  • 举报
回复
语法有误,应
delete from A where not exists (select B.* from B,A where A.supplier=B.supplier and A.invoice=B.invoice)
不过这样的话,如果子查询无记录,A表全删光
yesyesyes 2005-04-06
  • 打赏
  • 举报
回复
语法有误,应
delete from A where not exists (select * from B where A.supplier=B.supplier and A.invoice=B.invoice)
不过这样的话,如果子查询无记录,A表全删光
talantlee 2005-04-06
  • 打赏
  • 举报
回复
你得是sql server2000麼?是得話語句有錯,你這樣好象和B是關聯不到得

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧