The below script gives the following error message:
"Msg 8152, Level 16, State 10, Line 10 String or binary data would be truncated."
select convert(varbinary(max),HASHBYTES('md2',(select [Secteur]
,[Hub]
,[Group]
,[Enterprise]
,[Manager]
,[BM]
from [Hubs] for XML auto)))
I mention that the maximum length of input rows is 123 bytes.
Any ideas why this message? (I use SQL Server 2014) Many thanks
varbinary (maximum 8000 bytes)ORDER BYnor aWHEREin your query. That means you're converting the entire table to XML, with a row ordering that's not deterministic. That's probably not what you want as an input for a hash. If all you want is a mechanism to detect if the data has changed and you're not married to an MD2 hash over XML, consider usingCHECKSUM_AGG.