四海皆兄弟2011

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

sql中binary_checksum(*)的用法

sql中binary_checksum(*)的用法(转)

 

binary_checksum(*)可以用来检查修改过的行。

同一行在update后,该行的binary_checksum(*)就不同。 如

select title_id,binary_checksum(*)  from titles where  title_id=1 时title_id=1 的该行的binaru_checksum(*) 的值为123456 若此时 update titles set title='ddd' where title_id=1

再执行select title_id,binary_checksum(*)  from titles where title_id=1 会发现binary_checksum(*)的值发生了改变。

利用这个特性,我们可以先执行select title_id,binary_checksum(*) into t1 from titles 比如某段时间后需要检查或者在某个操作后需要检查有那些行发生了变化 就可以通过语句 select a.* from titles a,t1 b where a.title_id=b.title_id and a.binary_checksum(*)<>b.binary_checksum(*)

posted on   四海皆兄弟2011  阅读(2371)  评论(0编辑  收藏  举报

努力加载评论中...
点击右上角即可分享
微信分享提示