I have a table with image-type column and text-type column, such as TestTable(intColumn int, imageColumn image, textColumn text). I want to use HASHBYTES function to detect data
change, and then call these sql in my C# code.
But HASHBYTES could only deal with data type of "varchar", "nvarchar", "varbinary", so my
old code is:
select
*,
Binary_CheckSum(HASHBYTES('MD5',
CONVERT(nvarchar(max),
intColumn)),
HASHBYTES('MD5',
CONVERT(nvarchar(max),
imageColumn))
,
HASHBYTES('MD5',
CONVERT(binary(max),
textColumn)))
from dbo.Test
In this way, image or text will be truncated to 8000 bytes if their length is over 8000 bytes.
How can I use HASHBYTES function on image, text or ntext columns?
Thanks for your patience,
Danish