Explore Courses Blog Tutorials Interview Questions
0 votes
in SQL by (20.3k points)

I am specifically thinking about unsigned int.

Here is a practical example: what do you do when your identity column maxes out? It's possible to either go BigInt (8 bytes storage instead of 4) or to refactor the application to support negative integers, and even to create your own rules as indicated in this answer; neither of those options are optimal.

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

I understand that unsigned datatypes are not part of the SQL standard (SQL-2003) but still seems like a waste to me.

What is the reason of not including these (in SQL Server or in the standard)?

1 Answer

0 votes
by (119k points)
edited by

SQL Server does not support the UNSIGNED data type because it is complex to implement implicit type conversions.

You can use the following command to create an identity column to support negative values with seed value as -2,147,483,648 and increment value

Identity(-2147483648, 1)

If you want to learn SQL then take up this SQL online course that provides instructor-led training, certification, and also job assistance

Related questions

0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer
asked Dec 27, 2020 in SQL by Appu (6.1k points)

Browse Categories