D J Horton Consulting Ltd

Personal reference to useful tips and tricks for SQL Server, SQL Server Reporting Services and Crystal Reports.



My alternative to scraps of paper lying about.



Others may find bits of it useful!








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: