码迷,mamicode.com
首页 > 数据库 > 详细

sql中binary_checksum(*)的用法

时间:2014-11-27 12:39:43      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:ar   sp   strong   on   bs   时间   sql   nbsp   rom   

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(*)

sql中binary_checksum(*)的用法

标签:ar   sp   strong   on   bs   时间   sql   nbsp   rom   

原文地址:http://www.cnblogs.com/yelisen2011/p/4125917.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!