Collections:
Time-Only DATETIME Values in SQL Server Transact-SQL
What Happens If Time-Only Values Are Provided for DATETIME variables in SQL Server Transact-SQL?
✍: FYIcenter.com
If only time value is provided in a DATETIME variable, the SQL Server will pad the date value with a zero, representing the base date, January 1, 1900. The tutorial exercise below gives you some good examples:
-- 'hh:mi:ss.mmm' format DECLARE @x DATETIME; SET @x = '22:55:07.233'; SELECT @x; ----------------------- 1900-01-01 22:55:07.233 -- 'hh:mi:ss.mmmAM/PM' format DECLARE @x DATETIME; SET @x = '10:55:07.233PM'; SELECT @x; ----------------------- 1900-01-01 22:55:07.233 -- 'hh:miAM/PM' format DECLARE @x DATETIME; SET @x = '10:55PM'; SELECT @x; ----------------------- 1900-01-01 22:55:00.000
⇒ Out-of-Range DATETIME Values in SQL Server Transact-SQL
⇐ Date-Only DATETIME Values in SQL Server Transact-SQL
2017-04-08, 1559🔥, 0💬
Popular Posts:
What Is an Oracle Instance in Oracle? Every running Oracle database is associated with an Oracle ins...
How To Convert Numeric Values to Character Strings in MySQL? You can convert numeric values to chara...
How To Find Out What Privileges a User Currently Has in Oracle? Privileges granted to users are list...
How To Drop an Index in Oracle? If you don't need an existing index any more, you should delete it w...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...