July 3, 2006 at 1:10 pm
Hi,
I am trying to find a solution to generate a hash key for a given string (CompanyName) and store that information (HashKey). For example,
CREATE TABLE dbo.Example (CompanyName VARCHAR(250), HashKey CHAR(10))
INSERT INTO dbo.Example (CompanyName) VALUES('Microsoft')
SELECT CompanyName, HashKey FROM dbo.Example
Microsoft, BIXY38F24K
INSERT INTO dbo.Example (CompanyName) VALUES('Microsoft Inc.')
SELECT CompanyName, HashKey FROM dbo.Example
Microsoft, BIXY38F24K
Microsoft Inc., BIDXY3FE24
INSERT INTO dbo.Example (CompanyName) VALUES('Intel Inc.')
SELECT CompanyName, HashKey FROM dbo.Example
Microsoft, BIXY38F24K
Microsoft Inc., BIDXY3FE24
Intel Inc., OI3MXK95K3
Does anyone have this implemented?
Thank you,
R
July 3, 2006 at 1:31 pm
Have you looked at the the CHECKSUM function and the HashBytes function (HashBytes may only be in 2005 I can't remember) anyway both these built in fucntions can be used to create a hash
hth
David
July 3, 2006 at 1:57 pm
Thank you David.
I think CHECKSUM function should be good enough for what I am looking for.
July 4, 2006 at 11:51 am
CHECKSUM and BINARY_CHECKSUM are very poor hashes. Don't be surprised if you find almost 1% collisions. But as long as you don't rely on them for uniqueness, they can help in the creation of compact indexes for exact-lookup (not for key-range lookups).
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply