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
2017-04-15, 825👍, 0💬
Popular Posts:
What Happens to Your Transactions When ERROR 1213 Occurred in MySQL? If your transaction receives th...
How Fixed Length Strings Are Truncated and Padded in SQL Server Transact-SQL? When the length of the...
What is dba.FYIcenter.com Website about? dba.FYIcenter.com is a Website for DBAs (database administr...
How To Enter Unicode Character String Literals in SQL Server Transact-SQL? Unicode characters are mu...
How Fixed Length Strings Are Truncated and Padded in SQL Server Transact-SQL? When the length of the...