在SQL Server哈希code? [英] Hash Code in SQL Server?
问题描述
我试图解决一个独特的问题。感谢您的帮助与此有关。
有没有一种简单的方法来产生某种形式的哈希值code为创纪录的基础上它的几个字段值?
我想过只创建一个额外的列并置的一切,我要检查的数值的看法,但我检查,看看是否有更好的办法。
我想根据它们的值来识别的记录,因为我需要集团母公司记录由这些子记录的唯一性,如果让任何意义。
再次感谢您的任何建议。
SELECT
HASHBYTES(MD5,CAST(COL1为varbinary(MAX))+
CAST(COL2 AS VARBINARY(MAX)))
从
mytable中
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
这篇关于在SQL Server哈希code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!