Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Help with hash value function

Author  Topic 

rubs_65
Posting Yak Master

144 Posts

Posted - 2004-10-18 : 10:50:11
Hi,

I have a requirement that we need to separate our accounts (one of column in table) into 1024 buckets so I am thinking of applying hash function to this column and based on the hash send the account to one of bucket. How to I generate a hash function that will always divide the input into 1024 buckets. So basically we have to write a hash function that will take 1 input and associate it will particular bucket and it is deterministic that for each value it will always send it to same bucket. Any article or link will be helpful that can explain how to write this hash function?

Thanks
--Harvinder

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-10-18 : 11:05:38
Maybe i don't understand the question correctly? but could you use % (modulo)

ie:
Select bucketNum = AccountNumber % 1024

Corey
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-18 : 11:36:30
yes, please give us an example. not sure what you mean by "buckets".

- Jeff
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-10-18 : 19:52:29
Why would you even want to hash the accounts? This sounds like more of a computer science class assignment.
Go to Top of Page
   

- Advertisement -