[dba-SQLServer] SQL Server - Time only in date field

Stuart McLachlan stuart at lexacorp.com.pg
Sat Mar 31 18:40:12 CDT 2007


On 31 Mar 2007 at 14:33, JWColby wrote:

> Can SQL Server handle a date with just a time portion in the field?  IOW a
> date of 12:03 am without a date?

Yes. Does it just the way that Access does. 
It defaults to date 0 if no date part is specified. Date 0 is
January 1, 1900 

To retrieve the time as a string use Convert(char(8),myDate,8) for hh:mm:ss
or  Convert(char(12),myDate,14) if you want milliseconds.
(108 and114 return the same thing)

-- 
Stuart





More information about the dba-SQLServer mailing list