Why is running this query in Visual Studio (Execute SQL task) not giving the same result as running it directly on the server in SSMS?
The column is binary(32) not null.
UPDATE table1
SET SHA2_256 = HASHBYTES(
'SHA2_256',
CONCAT(
ISNULL(CONVERT(NVARCHAR(MAX), col1), ''),
ISNULL(CONVERT(NVARCHAR(MAX), col2), ''),
ISNULL(CONVERT(NVARCHAR(MAX), col3), ''),
ISNULL(CONVERT(NVARCHAR(MAX), col4), '')
)
);
Running it in VS gives the same value for all :
0x3010E90F290FE40E240EDF0D1F0DDA0C060CC10BFB0AB60AF009AB09E508A008
Running it in SSMS works fine, providing with distinct values.