Wednesday, 26 May 2010

Datetime types in SQL - SQL





You cannot store only the date or time portion.

If only the date is specified, 00:00:00.000 is stored in the time portion.
If only the time is specified, 1900-01-01 is stored in the date portion.

For example,

SELECT CAST ('20100526' as datetime)
SELECT CAST ('12:47:59:009' as datetime)

No comments: