Collections:
Overflow Errors on Converting Big Values to Integers in SQL Server
What Happens When Converting Big Values to Integers in SQL Server Transact-SQL?
✍: FYIcenter.com
If you are converting a numeric expression to an integer data type and the value is too big for integer storage size, you will get an arithmetic overflow error as shown in the following examples:
-- Overflow error on implicit conversion DECLARE @x FLOAT(24); DECLARE @y TINYINT; SET @x = 12345.12E+00; SET @y = @x; GO Msg 232, Level 16, State 1, Line 4 Arithmetic overflow error for type tinyint, value = 12345.120117. -- Overflow error on explicit conversions DECLARE @x FLOAT(24); SET @x = 12345.12E+00; SELECT CAST(@x AS TINYINT); SELECT CONVERT(TINYINT, @x); GO Msg 232, Level 16, State 1, Line 4 Arithmetic overflow error for type tinyint, value = 12345.120117. Msg 232, Level 16, State 1, Line 5 Arithmetic overflow error for type tinyint, value = 12345.120117.
⇒ Overflow Errors on Converting Big Values to NUMERIC in SQL Server
⇐ CONVERT() - Converting Character Strings to Numeric Values in SQL Server
⇑ Numeric Expressions and Functions in SQL Server Transact-SQL
2017-03-22, 1438🔥, 0💬
Popular Posts:
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want t...
How REAL and FLOAT Literal Values Are Rounded in SQL Server Transact-SQL? By definition, FLOAT(n) sh...
What Is a Dynamic Performance View in Oracle? Oracle contains a set of underlying views that are mai...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...