none
How Can I Use HASHBYTES Function on Image or Text Columns? RRS feed

  • 问题

  • 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

    • 已移动 Frank Xu Lei 2011年3月3日 1:13 SQL 大数据处理 (发件人:Windows Azure Forum)
    2011年2月24日 3:28