Microsoft® SQL Server™ allows you to specify date data as an unseparated string. The date data can be specified with four, six, or eight digits, an empty string, or a time value without a date value.
The SET DATEFORMAT session setting does not apply to all-numeric date entries (numeric entries without separators). Six- or eight-digit strings are always interpreted as ymd. The month and day must always be two digits.
This is the valid unseparated string format:
[19]960415
A string of only four digits is interpreted as the year. The month and date are set to January 1. When specifying only four digits, you must include the century.
Date and Time Data | SET DATEFORMAT |
datetime and smalldatetime |