Why doesn't SQL Server support an unsigned data type?

I specifically think of unsigned int .

Here's a practical example: what will you do when your personal column is maximized? You can either go BigInt (store 8 bytes instead of 4), or reorganize the application to support negative integers, and even create your own rules, as indicated in this answer ; none of these options are optimal.

UInt would be an ideal solution, but SQL Server does not offer it (where MySQL is running).

I understand that unsigned data types are not part of the SQL standard (SQL-2003), but they still seem like a waste to me.

What is the reason for not including them (in SQL Server or in the standard)?

+48
sql sql-server unsigned-integer sqldatatypes
Dec 15 2018-10-15
source share
3 answers

If I were to guess, I would say that they are trying to avoid type propagation. Generally speaking, there is nothing that an unsigned integer can mean that a signed integer cannot do. As for the case where you need a number from 2147483648 to 4294967296, you should probably go for an 8-byte integer, as the number will also eventually exceed 4294967296.

+35
Dec 15 '10 at 16:08
source share

For this purpose, you can use -2,147,483,648 as the initial value.

 Identity(-2147483648, 1) 
+30
Jan 09 '12 at 15:05
source share

I found a similar question in Microsoft Connect.

In response from Jim Hogg (Program Manager), there are some pro and con to add unsigned int. The main con is the rules for implementing implicit type conversions, which become a nightmare to get right.

The request was closed as "Do not fix."

+24
Aug 08 '13 at 7:25
source share



All Articles