Collections:
Out-of-Range DATETIME Values in SQL Server Transact-SQL
What Are Out-of-Range Errors with DATETIME values in SQL Server Transact-SQL?
✍: FYIcenter.com
When you enter DATETIME values, you may get out-of-range errors due to two common mistakes:
The tutorial exercise below shows you some data and time out-of-range errors:
-- Invalid date DECLARE @x DATETIME; SET @x = '30-Feb-2017 22:55:07.233'; ----------------------------------- Msg 242, Level 16, State 3, Line 2 The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. -- Date below the DATETIME limits DECLARE @x DATETIME; SET @x = '19-May-1752 22:55:07.233'; ----------------------------------- Msg 242, Level 16, State 3, Line 2 The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. -- Invalid time DECLARE @x DATETIME; SET @x = '19-May-2017 24:55:07.233'; ----------------------------------- Msg 242, Level 16, State 3, Line 2 The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
2017-04-08, 899👍, 0💬
Popular Posts:
How REAL and FLOAT Literal Values Are Rounded in SQL Server Transact-SQL? By definition, FLOAT(n) sh...
How To Find Out What Privileges a User Currently Has in Oracle? Privileges granted to users are list...
What Are Bitwise Operations in SQL Server Transact-SQL? Bitwise operations are binary operations per...
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? I...
How To Create a Table in a Specific Tablespace in Oracle? After you have created a new tablespace, y...