May 25, 2006 at 9:19 pm
i have few bit values in my table. when i export the records in the table using bcp command, it's exporting all good except bit value for one column is incorrectly exported. some of the values were null and some 0 or 1 but when exported, null values were also exported as 1. i changed all the null values to 0 and tried again and still the same. it's happening with one column only. irony is i have table with same schema in two databases and there is same problem. btw, that column with problem was added later.
May 26, 2006 at 1:16 am
Not quite the same (0's not 1's), but maybe this snip from BOL can shed some light? (particularly the last bit) This suggests you're using either the -V parameter, or an old version of bcp. Do check out your bcp version, and also if there are more than one copy of bcp.exe on your box. Sometimes we don't execute what we think
-V (60 | 65 | 70)
Performs the bulk copy operation using data types from an earlier version of SQL Server. Use this option in conjunction with character (-c) or native (-n) format. This option does not prompt for each field; it uses the default values. For example, to bulk copy date formats supported by the bcp utility provided with SQL Server 6.5 (but no longer supported by ODBC) into SQL Server 2000, use the -V 65 parameter.
Important When bulk copying data from SQL Server into a data file, the bcp utility does not generate SQL Server 6.0 or SQL Server 6.5 date formats for any datetime or smalldatetime data, even if -V is specified. Dates are always written in ODBC format. Additionally, null values in bit columns are written as the value 0 because SQL Server versions 6.5 and earlier do not support nullable bit data.
/Kenneth
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply