Submitted byCategory
Review Cycle
.
Public
Joachim Mutter/sysarc
on 11/05/2008 at 04:28 PM
SQLServer\Documentation

SQL Datetime and milliseconds

Duration

DateOnly

select
floor(convert(float, convert(datetime, startdate)))
from ImError

TimeOnly

select
Convert(DATETIME, Convert(binary(8), convert(int, substring(convert(binary(8), startdate), 5, 4)))) [Starttime] from ImError 
from ImError 
SQL Server uses 8 bytes to store the datetime data type.
Datetime vs smalldatetime: