Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the value range of int type in SQL Server?
What is the value range of int type in SQL Server?
The default length of the value of type int in SQL Server is 4, that is, 4 bytes and 32 bits, and the data range is -2 3 1 (-2, 147,483,648) to 2 3 1- 1 (2,147). The SQL-92 synonym for int is integer.

Int data types are supported where integer values are supported. However, in some special cases, int cannot be used. You can use bigint when the integer value is beyond the range supported by the int data type. In SQL Server, int data type is the main integer data type.

Extended data:

When using arithmetic operators such as+,-,* and/or% to implicitly or explicitly convert constant values of int, smallint, tinyint or bigint into float, real, decimal or numeric data types, SQL Server will apply different rules when calculating the accuracy of data types and expression results, depending on whether the query is parameterized automatically.

Therefore, similar expressions in queries may sometimes produce different results. If the query is not parameterized automatically, the constant value should be converted to a numerical value before it is converted to the specified data type, which is accurate enough to save the constant value. For example, the constant value 1 is converted to a numerical value (1, 0), and the constant value 250 is converted to a numerical value (3,0).