I need to store ulong values as a primary key in SQL Server. Since SQL Server doesn't have a ulong datatype (or for that matter anything unsigned), the only way to go is to have column as varbinary(8).
Now, having a varbinary as a PK doesn't sound like a good idea. So what are the alternatives to store ulong values?
ulong? Do you expect to exceed the9,223,372,036,854,775,807that can be stored asbigint? Are these surrogate key values? If so how are they generated? – Martin Smith Feb 3 at 17:11In theory they could- sounds like you should get confirmation on specifics rather than design a system based around "in theory"... IMHObigintshould be more than enough for anything practical. – Aaron Bertrand Feb 3 at 17:30varbinarydata fine. Of course have to make sure that you are seeking for the right thing, If the number is stored as0x01then seeking on0x0000000000000001won't return anything. Which means the PK could actually contain semantic duplicates when converted back toulong– Martin Smith Feb 3 at 19:16ulongcode already set in stone, or is it possible to use something else? – Jon Seigel Feb 3 at 23:44