开发者

Hash Code in SQL Server?

I am trying to solve a unique problem. Thanks for any help with this.

Is there an easy way to generate some kind of a hash code for a record based on several of its field values?

I thought about just creating a view with an extra column that concatenates all of the values that I want to check, but I'm checking to see if there is a better way.

I am trying to identify records based on their values, because I need to开发者_如何转开发 group parent records by the uniqueness of these child records, if that makes any sense.

Thanks again for any advice.


SELECT
    HASHBYTES('MD5', CAST(col1 AS VARBINARY(MAX)) + 
        CAST(col2 AS VARBINARY(MAX)))
FROM
    mytable
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜