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
2017-04-08, 837👍, 0💬
Popular Posts:
How To Count Duplicated Values in a Column in SQL Server? If you have a column with duplicated value...
How AdventureWorksLT tables are related in SQL Server? There are 12 user tables defined in Adventure...
What Happens If the UPDATE Subquery Returns Multiple Rows in MySQL? If a subquery is used in a UPDAT...
How To Change the Name of a Database User in SQL Server? If you want to change the name of an existi...
How To Enter Unicode Character String Literals in SQL Server Transact-SQL? Unicode characters are mu...