Copying Date and Money Values

The bcp utility (which uses the ODBC bulk copy API, rather than the DB-Library bulk copy API) imports character format data files containing date values using ODBC format (yyyy-mm-dd hh:mm:ss[.f...]). To bulk copy date formats supported by earlier versions of the bcp utility, but no longer supported by ODBC, into Microsoft® SQL Server™, use the -6 parameter. When using the -6 parameter, the bcp utility first attempts to convert the date value in the data file using ODBC date format. If the conversion fails, bcp attempts to convert the date value using DB-library formats.


Note Using the -6 flag can affect performance because of the overhead of supporting multiple date conversions, and only works with the native (-n) and character (-c) formats (not Unicode).


The bcp utility always exports character format data files using the ODBC default format for datetime and smalldatetime values even if -6 is specified. For example, a datetime column containing the date 12 Aug 1998, is bulk copied to a data file as the character string 1998-08-12 00:00:00.000.

The BULK INSERT statement does allow any date format supported by SQL Server to be used when importing data into SQL Server.

The bcp utility exports money values in character format data files without digit grouping symbols such as comma separators, but with four digits after the decimal point. For example, a money column containing the value 1,234,567.123456 is bulk copied to a data file as the character string 1234567.1235. To import files created by an earlier version of bcp (that used the DB-Library API), specify the -6 parameter.

To bulk copy money, datetime, or smalltime values into SQL Server using the regional format defined for the locale setting of the client computer, specify the -R parameter.

See Also
Backward Compatibility Details (Level 2) CAST and CONVERT
Use6xCompatible Property Modifying Native and Character Format bcp Using -6

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.