Saturday, March 28, 2009

SQL 2008 Date

SQL 2000 and 2005 don't have option to enter only date in DateTime column. Even if we don't provide time while inserting date in DateTime column, it enters the date along with time like the below screen shot.




SQL 2008 has the feature to store only date, as it has the datatype of Date only rather tahn DateTime.

DECLARE @datetest DATE
SELECT @datetest = '3/28/2009'
SELECT @datetest as [Date]

Output:

Date
----------
2009-03-28

No comments:

Site Meter