By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,266 Members | 1,312 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,266 IT Pros & Developers. It's quick & easy.

Computed Binary Field

P: 34

I have a table with a primary key, identity value. In addition to some other fields I also have a computed field to generate a binary identifier for the row based on the identity value (eg. PK ID of 1 would generate a binary ID of 1 (Power(2, [1] -1) = 1), PK ID of 4 would generate a binary ID of 8 (Power(2, [4] - 1) = 8). The problem is that there are +70 rows in this table so the binary ID gets quite large - out of the scope of int, bigint or float. Naturally the field should be of varbinary(max) but the Power function returns the numeric datatype that is passed in; bigint is too small and if I pass in a float I cannot convert the value back to a varbinary value.

Any ideas on ways to tackle this so that I can have an auto generated binary value based on the identity value?

Jul 21 '09 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 2,878
Where are you using this computed field? If it's on the front-end, try doing all the binary ID on the front-end. If not, you might be able to solve this temporarily but as your record grows, you will really have a problem on this. You might want to consider another technique.

Good luck!

--- CK
Jul 22 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.