Der folgende CodeVarbinäre Werte verketten und die Null-Werte ignorieren?
select hashbytes('SHA1', cast(a as varbinary(max))) FROM (select 0 a, null b) t
kehrt 0x9069CA78E7450A285173431B3E52C5C25299E473
.
Und der folgende Code gibt null zurück.
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
Ich versuchte, die null auf 0, aber der Hash geändert zu konvertieren.
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
Wie die Null varbinary
Werte zu ignorieren, wenn verketten?