Microsoft KB Archive/67659

= INFO: BCPing in Just the Date of Datetime Column =

Article ID: 67659

Article Last Modified on 2/14/2005

-

APPLIES TO


 * Microsoft SQL Server 4.21a Standard Edition
 * Microsoft SQL Server 6.0 Standard Edition
 * Microsoft SQL Server 6.5 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q67659



SUMMARY
This article discusses what happens when just the date is BCPed into a datetime field.



MORE INFORMATION
It is possible to BCP just the date into a datetime field. The storage size will be the same as if you had both the date and time. For a datetime column, this is 4 bytes for the number of days before/after January 1, 1900, and 4 bytes for the number of milliseconds after midnight on that day. If you select what you have input with BCP from SQL Server, you will see the time &quot;12:00AM&quot; on the end of each date because the number of milliseconds after midnight is 0 (zero).

To display just the date portion of a datetime field, use the style parameter of the convert function. For example:

select convert(char(12),getdate,3)

Additional query words: Windows NT

Keywords: kbinfo KB67659

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.