Computed Binary Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Murdz
    New Member
    • Aug 2007
    • 34

    Computed Binary Field

    Hello.

    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?

    Cheers
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    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

    Comment

    Working...