Collections:
Casting Numeric Values to DATETIME in SQL Server Transact-SQL
Can I cast numeric values to DATETIME values in SQL Server Transact-SQL?
✍: FYIcenter.com
Yes, you can cast numeric values to DATATIME values in Transact-SQL. The implicit casting rules are for numeric values to DATETIME values are:
Here are some examples of casting numeric values to DATETIME values implicitly:
DECLARE @x DATETIME; SET @x = 0; SELECT @x; ----------------------- 1900-01-01 00:00:00.000 DECLARE @x DATETIME; SET @x = 1; SELECT @x; ----------------------- 1900-01-02 00:00:00.000 DECLARE @x DATETIME; SET @x = 0.1; SELECT @x ----------------------- 1900-01-01 02:24:00.000 DECLARE @x DATETIME; SET @x = -1; SELECT @x; ----------------------- 1899-12-31 00:00:00.000
⇒ Entering 0.001 Second in DATETIME in SQL Server Transact-SQL
⇐ Entering Date and Time Values in SQL Server
2017-04-15, 2542🔥, 0💬
Popular Posts:
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...
How To Drop an Index in Oracle? If you don't need an existing index any more, you should delete it w...
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
How To Fix the INSERT Command Denied Error in MySQL? The reason for getting the "1142: INSERT comman...
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...