Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
4 bytes unsigned value
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01083748
Message ID:
01083848
Views:
9
David,
Thanks for the reply. That makes a lot of sense. You understood exactly what I meant when I said "invisible". I quess I am sometimes thinking from a VFP browse standpoint (there is still VFP in me).
Do see any problems using binary(4) as a PK? I have never used anything but int, bigint or guid as PK before (well there was this one time I used datetime as PK), I don't know why I have this fear of using binary(4) as my PK.

Einar

>What is so "invisible" about binary(4)? if you don't like seeing it in hex cast it out to something more friendly.
>
>
>create table #temp1 ( bigint1 char(4), bigint2 binary(4) )
>
>insert into #temp1 values ( char(0) + char(0) + char(0) + char(0), 0x00000000 )
>insert into #temp1 values ( char(255) + char(255) + char(255) + char(255), 0xFFFFFFFF )
>insert into #temp1 values ( char(255) + char(255) + char(255) + char(255), 1234 )
>
>select * from #temp1
>select cast( bigint2 as char(4) ) from #temp1
>select cast( cast( bigint2 as bigint ) as decimal(10,0)) from #temp1
>
>
>>I need to record a 4 bytes unsigned value in my table (range 0 - 4,294,967,295). Currently I am using bigint to represent this value but I am wasting around 3 bytes per record (especially considering that a record is 2100 bytes).
>>
>>Anywho, do I have any other options than to use bigint? Does MSSQL have an unsigned field type?
>>I know I could use binary(4) but the field is PK so I would like it to be a "visible" type.
>>
>>Are there any problems using binary(x) as PK?
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform