Convert datetime and smalldatetime data
ConvertDatetimeMicrosoft SQL Server 2000 rejects all values that cannot be recognized as dates (including dates before January 1, January 1, 1753 ). When the date is within the appropriate range (January 1-20, 1900-June 6 ),DatetimeConvertSmalldatetime. The time value is rounded to the nearest minute.
In this exampleSmalldatetimeAndDatetimeConvertVarcharAndBinaryData type.
Declare @ mydate_sm smalldatetime
Set @ mydate_sm = '2014/1/98'
Select cast (@ mydate_sm as varchar) as sm_date_varchar
Go
Declare @ mydate datetime
Set @ mydate = '2014/1/98'
Select cast (@ mydate as binary) as date_binary
Go
The following is the result set:
(1 row (s) affected)
Sm_date_varchar
------------------------------
Apr 5 1998 AM
(1 row (s) affected)
Date_binary
--------------------------------------------------------------
0x00000000000000000000000000000000000000000000000000008c3000000000
(1 row (s) affected)
See
Cast and convert
Data Type
1988-2000 Microsoft Corporation. All rights reserved.