INF: BCPing in Just the Date of Datetime Column

Last reviewed: April 25, 1997
Article ID: Q67659

The information in this article applies to:

  - Microsoft SQL Server version 4.2 for OS/2
  - Microsoft SQL Server version 4.2

The following information discusses what happens when just the date is BCPed into a datetime field.

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 since January 1, 1900, and 4 bytes for the number of milliseconds after midnight on that day. If you select from SQL Server what you have input with BCP, you will see the time "12:00AM" 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 : kbtool SSrvBCP SSrvGen SSrvTrans
Version : 4.2 | 4.2
Platform : OS/2 WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.