Collections:
Overflow Errors with INT Values in SQL Server Transact-SQL
What Happens If an Integer Is Too Big for INT (INTEGER) Date Type in SQL Server Transact-SQL?
✍: FYIcenter.com
If you are entering an INT data type literal with representing an integer value too big for INT data type to store, the SQL Server will give you an arithmetic overflow error. The same error will happen on BIGINT, INT, SMALLINT, and TINYINT data types.
Remember that INT data types uses 4 bytes to an integer value between -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647). The tutorial exercise below gives an example of arithmetic overflow errors.
-- INT value in the range DECLARE @x INT; SET @x = 2147483647; SELECT @x; ---------- 2147483647 -- INT value overflow DECLARE @x INT; SET @x = 2147483648; ----------------------------------- Msg 8115, Level 16, State 2, Line 2 Arithmetic overflow error converting expression to data type int.
⇒ Overflow and Rounding on NUMERIC Values in SQL Server Transact-SQL
⇐ Exact Numeric Data Types in SQL Server Transact-SQL
2017-04-19, 4591🔥, 0💬
Popular Posts:
How to continue to the next iteration of a WHILE loop in SQL Server Transact-SQL? How to use CONTINU...
How to calculate the storage size of a JSON (JavaScript Object Notation) value using the JSON_STORAG...
How to set the current database in SQL Server? Once you are connected to the SQL Server, you should ...
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...