SQL Server provides considerable flexibility in reading date and time data as character strings, only a subset that is most directly relevant for migrations is presented here.
SQL Server outputs date, time and datetime values in the following formats: yyyy-mm-dd, hh:m:ss.nnnnnnn (n is dependent on the column definition) and yyyy-mm-dd hh:mm:ss.nnnnnnn (n is dependent on the column definition).
Format Type | Date Format | Example |
---|---|---|
ANSI/ISO | yyyy-mm-dd | 1987-10-12 |
Alphabetic | The month is specified as a three character abbreviation or the full month name. | Apr 15 1996
15 Apr 1996 1996 Apr 15 |
Numeric | The month is specified as a number and the separator can be slash, hyphen or period. The order of day, month year parts can be changed by a TSQL SET DATEFORMAT or SET LANGUAGE statements. The initial order is determined from the default language for the login. The default format for us_english is mdy. The settings are stored in the table sys.syslanguages. | 15/04/1996 04.15.1996 1996-4-15 |