SqlServer Checksum in C#

前端 未结 5 671
忘了有多久
忘了有多久 2020-12-06 10:55

I\'m using the chechsum function in sql server 2008 R2 and I would like to get the same int values in a C# app. Is there any equivalent method in c# that returns the values

5条回答
  •  青春惊慌失措
    2020-12-06 11:54

    The T-SQL documentation does not specify what algorithm is used by checksum() outside of this:

    CHECKSUM computes a hash value, called the checksum, over its list of arguments. The hash value is intended for use in building hash indexes. If the arguments to CHECKSUM are columns, and an index is built over the computed CHECKSUM value, the result is a hash index. This can be used for equality searches over the columns.

    It's unlikely to compute an MD5 hash, since its return value (the computed hash) is a 32-bit integer; an MD5 hash is 128 bits in length.

提交回复
热议问题