Does Microsoft SQL Server support unsigned integer data types?

I am trying to learn a bit more about the data type choices and helping a friend in his database project, I know that MySQL does.


No. The numeric data types are all signed.

For example an int is from approx. -2^31 to +2^31.

If you have a value just shy of 2^32 you will have to use a larger data type such as bigint. There are finer points here, but out of scope of this discussion.

Related Q & A:

Why aren't unsigned integer types available in the top database platforms?


| improve this answer | |
  • TINYINT isn't signed – Martin Smith Feb 15 '19 at 17:31

You can easily emulate unsigned 32-bit int with your regular, signed bigint. Do whatever arithmetics needs to be done, AND with 0xFFFFFFFF for every operation that may potentially overflow the lower 32 bits.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.