T-SQL Tutorial

SQL Server DATE


In SQL Server, the DATE data type is used to store date values. It stores the date as a three-byte integer, representing the number of days since January 1, 1900. The range of values that can be stored in a DATE column is from January 1, 1753 to December 31, 9999. The date is stored in the format of YYYY-MM-DD and does not include the time or time zone information.

When creating a table, you can specify DATE as the data type for a column to indicate that the column will only store date values. The DATE data type also provides several built-in functions to extract different parts of the date such as year, month, and day, or to perform date calculations.


DATE syntax

date

PropertyValue
Default string literal formatYYYY-MM-DD
Range0001-01-01 through 9999-12-31
Length10
Storage size3 bytes, fixed
CalendarGregorian

DATE example

USE model;
GO
DECLARE @date date= '08-21-14';
SELECT @date AS 'Date';
GO

Date
2014-08-21

Summary: On Transact SQL language the date is part of date and time data types and define a date on sql server.