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, 2294🔥, 0💬
Popular Posts:
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...
How To Connect to a MySQL Server with a Port Number in MySQL? If you want to connect a MySQL server ...
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...
Where to find answers to frequently asked questions on Downloading and Installing SQL Server 2005 Ex...