--如果表中没有text、ntext、image、cursor ,可以考虑使用checksum(),如:
--A中有,而B中没有的数据:select *
from A
where checksum(*) not in (select checksum(*) from B)
--A、B中都有的数据select *
from A
where checksum(*) in (select checksum(*) from B)
--A中有,而B中没有的数据:select *
from A
where checksum(*) not in (select checksum(*) from B)
--A、B中都有的数据select *
from A
where checksum(*) in (select checksum(*) from B)
解决方案 »
- 多用户操作情况下如何保证自动生成证号的连续性和唯一性?
- SQL Server Compact 3.5问题
- 请SQL Server 2008高手指教如何能查询出表字段的Description属性
- 这个更新可以一句sql语句可以写出来吗?
- 数据库sum函数的问题
- Sql Server 2005如何调用excel2003中的VBA函数和Excel函数?
- sql无法自动备份,提示执行API:CreateProcess失败,急,在线等!!!!
- 如何返回数据库所有的表名
- 为何我的ODBC连不上SQL SERVER
- WIN2000 高级服务器版 和SQL SERVER 企业版的价格是多少?
- 这样能否求平均值
- 高手帮忙,急!! 建表后给字段加check约束,
不过还是不够简约. 很奇怪MS为什么不实现intersect运算和minus运算.在字面上就让人很容易理解.checksum........
有没有机率会出现不同两行结果哈希码一样的情况?
在海量数据中,担心出现此问题.
如何用一句SQL返回表A中存在的id,name结果集而在表B中不存在的id,name结果集select A.* from A left join B on A.id=B.id and A.name=B.name where B.id is nullselect * from A where not exists(select top 1 * from B where A.ID=B.ID)这两个都可以.
--如果查所有字段,前提:表中不能有text、ntext、image、cursor 数据类型的字段。用CheckSum()最简单:select * from A where checksum(*) not in (select checksum(*) from B)