0
次のコードvarbinary値を連結し、null値を無視しますか?
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
連結時にNULL varbinary
の値を無視する方法はありますか?