Unseparated String Format

Microsoft SQL Server 2005 allows you to specify date data as an unseparated string. The date data can be specified with 4, 6, or 8 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 such as numeric entries without separators. The 6-digit or 8-digit strings are always interpreted as ymd. The month and day must always be 2 digits.

This is the valid unseparated string format:

[19]960415

A string of only 4 digits is interpreted as the year. The month and date are set to January 1. When specifying only 4 digits, you must include the century.

See Also

Concepts

Using Date and Time Data

Other Resources

Date and Time (Transact-SQL)
SET DATEFORMAT (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance