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
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
Comment