Hello,
I need to generate HASH of text values for my app. I can generate hash values for normal fields using CHEKCSUM and BINARY_CHECKSUM function but it does not support checksum of text, ntext, image, and cursor, as well as sql_variant.
How can I generate checksums of such datatype.
KaramCan anybody help me?|||CHECKSUM() by parts.
split ntext to blocks of nvarchar(4000) and use check sum.
Originally posted by karam_chand03
Hello,
I need to generate HASH of text values for my app. I can generate hash values for normal fields using CHEKCSUM and BINARY_CHECKSUM function but it does not support checksum of text, ntext, image, and cursor, as well as sql_variant.
How can I generate checksums of such datatype.
Karam|||Thanks for the answer.
Can I use it for datatypes like image, sql_variant?
A simple code on how to break it up and get a hash value will be helpful.|||Hello,
I am still unable to figure out but how can I generate checksum of the whole column in one SQL query? Is it possible?
Karam|||you can generate checksum() to whole column
like
select checksum(*) from tablename
provided none of the columns are of text ntext image data types
Originally posted by karam_chand03
Hello,
I am still unable to figure out but how can I generate checksum of the whole column in one SQL query? Is it possible?
Karam|||Hello,
Thats the problem. I do have those unsupported columns and I need to generate hash value from it. In MySQL (where I come from) has a md5() function to generate hash value dfor every type of data it supports.
What I can think of is that I can convert every such data to varbinary and then employ checksum on it. But that is failing as if I convert some char values to varbinary and then running checksum on it, it is returning the same data.
Is it feasible?
Karam|||I don't think so.
convert text to varchar and ntext to nvarchar....
and check.
Originally posted by karam_chand03
What I can think of is that I can convert every such data to varbinary and then employ checksum on it. But that is failing as if I convert some char values to varbinary and then running checksum on it, it is returning the same data.
Is it feasible?
Karam
Showing posts with label generate. Show all posts
Showing posts with label generate. Show all posts
Wednesday, March 7, 2012
CheckSum function
Why when I use different uniqueidentifier id will generate the same checksum
value? 911433607
SELECT checksum(CAST(('{A933B626-9F52-4D62-8B59-A7B1E1F243D0}') AS
uniqueidentifier))
SELECT checksum(CAST(('{844A9A36-3B5D-4359-8A62-A61A8836714F}') AS
uniqueidentifier))CHECKSUM won't produce a unique value for every conceivable input. How
could it, given that there are only a few billion possible checksums?
David Portas
SQL Server MVP
--|||To add to David's response:
http://www.cut-the-knot.org/do_you_know/pigeon.shtml
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--
"Simon Lim" <Simon Lim@.discussions.microsoft.com> wrote in message
news:AAB87EED-C006-4F09-B302-6512F4A47E79@.microsoft.com...
> Why when I use different uniqueidentifier id will generate the same
checksum
> value? 911433607
> SELECT checksum(CAST(('{A933B626-9F52-4D62-8B59-A7B1E1F243D0}') AS
> uniqueidentifier))
>
> SELECT checksum(CAST(('{844A9A36-3B5D-4359-8A62-A61A8836714F}') AS
> uniqueidentifier))|||True also. thanks.
"Adam Machanic" wrote:
> To add to David's response:
> http://www.cut-the-knot.org/do_you_know/pigeon.shtml
>
> --
> Adam Machanic
> SQL Server MVP
> http://www.datamanipulation.net
> --
>
> "Simon Lim" <Simon Lim@.discussions.microsoft.com> wrote in message
> news:AAB87EED-C006-4F09-B302-6512F4A47E79@.microsoft.com...
> checksum
>
>
value? 911433607
SELECT checksum(CAST(('{A933B626-9F52-4D62-8B59-A7B1E1F243D0}') AS
uniqueidentifier))
SELECT checksum(CAST(('{844A9A36-3B5D-4359-8A62-A61A8836714F}') AS
uniqueidentifier))CHECKSUM won't produce a unique value for every conceivable input. How
could it, given that there are only a few billion possible checksums?
David Portas
SQL Server MVP
--|||To add to David's response:
http://www.cut-the-knot.org/do_you_know/pigeon.shtml
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--
"Simon Lim" <Simon Lim@.discussions.microsoft.com> wrote in message
news:AAB87EED-C006-4F09-B302-6512F4A47E79@.microsoft.com...
> Why when I use different uniqueidentifier id will generate the same
checksum
> value? 911433607
> SELECT checksum(CAST(('{A933B626-9F52-4D62-8B59-A7B1E1F243D0}') AS
> uniqueidentifier))
>
> SELECT checksum(CAST(('{844A9A36-3B5D-4359-8A62-A61A8836714F}') AS
> uniqueidentifier))|||True also. thanks.
"Adam Machanic" wrote:
> To add to David's response:
> http://www.cut-the-knot.org/do_you_know/pigeon.shtml
>
> --
> Adam Machanic
> SQL Server MVP
> http://www.datamanipulation.net
> --
>
> "Simon Lim" <Simon Lim@.discussions.microsoft.com> wrote in message
> news:AAB87EED-C006-4F09-B302-6512F4A47E79@.microsoft.com...
> checksum
>
>
Labels:
911433607select,
checksum,
checksumvalue,
database,
function,
generate,
microsoft,
mysql,
oracle,
server,
sql,
uniqueidentifier
Subscribe to:
Posts (Atom)