下面的代码
select hashbytes('SHA1', cast(a as varbinary(max))) FROM (select 0 a, null b) t返回0x9069CA78E7450A285173431B3E52C5C25299E473。
下面的代码返回null。
select hashbytes('SHA1', cast(a as varbinary(max))
+ cast(b as varbinary(max))
+ cast(c as varbinary(max))
FROM (select 0 a, null b, null c) t -- There may be many columns我试图将null转换为0,但哈希发生了变化。
select hashbytes('SHA1', cast(a as varbinary(max))
+ isnull(cast(b as varbinary(max)), 0))
+ isnull(cast(c as varbinary(max)), 0))
FROM (select 0 a, null b, null c) t 如何在拼接时忽略空的varbinary值?
https://stackoverflow.com/questions/44423146
复制相似问题