Generate a hash for a set of rows in sql server

前端 未结 4 695
春和景丽
春和景丽 2021-01-17 12:24

Is there any way in SQL Server 2012 to generate a hash of a set of rows and columns?

I want to generate a hash, store it on the parent record. The when an update co

4条回答
  •  太阳男子
    2021-01-17 12:53

    select HashBytes('md5',convert(varbinary(max),(SELECT * FROM MyChildTable WHERE ParentId = 2 FOR XML AUTO)))
    

    but HashBytes is limited to 8000 bytes only... you can make a function to get de Md5 for every 8000 bytes....

提交回复
热议问题