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 2014-11-27 11:09 四海皆兄弟2011 阅读(2371) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步