patternsqlMinor
Unsigned Int datatypes
Viewed 0 times
intunsigneddatatypes
Problem
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.
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.
Solution
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?
Documentation:
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?
Documentation:
- int, bigint, smallint, and tinyint (Transact-SQL)
- Data Types (Transact-SQL)
Context
StackExchange Database Administrators Q#132707, answer score: 5
Revisions (0)
No revisions yet.