本文介绍了散列一个 SQL 行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法对 SQL 表中的一行进行 md5sum 来检查是否有任何列被修改?

Is there a way to md5sum a row in a SQL table to check whether any column has been modified?

我想检查是否有任何特定列与我保存在文本文件中的数据的旧副本(我将在 C# 中使用 md5sum)进行了更改.

I would like to check whether any particular column has been changed versus an old copy of the data which i hold in a text file (which I will md5sum in C#).

每行只需 md5sum-ing

Just md5sum-ing each row

推荐答案

CHECKSUM(*)BINARY_CHECKSUM(*)CHECKSUM_AGG.他们像校验一样执行 CRC32,但是为了检测行的变化,它应该绰绰有余(你说的是 40 亿分之一的假阴性碰撞机会).

There are CHECKSUM(*), BINARY_CHECKSUM(*) and CHECKSUM_AGG. They do CRC32 like checkum, but for detecting changes to a row it should be more than enough (you are talking about 1 in 4 billion chances for a false negative collision).

使用 HASHBYTES 进行加密哈希需要您构造表示行"的表达式.

Doing a cryptographic hash using HASHBYTES requires you to construct an expression representing the 'row'.

这篇关于散列一个 SQL 行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-23 01:33