Hi,

I exported data from a table that has column with datatype as
'nvarchar' with length 31 and has NOT NULL constraint with collation as
"database default".

All the data for this column has '' as value.

I exported this table to a .csv file using command line utility "BCP".

The query was:
C:\Program Files\Microsoft SQL Server\80\Tools\Binn>bcp "SELECT * FROM
MYSYSTEM..cfgDevices" queryout D:\mytemp.csv -t , -c -T


Export operation Succeeded. The particular column has NO VALUE in the
.csv file.

Now I changed only the first column(primary key) in the .csv file and
tried to import it back to the same table in the databse using "BCP"

The Query was:
C:\Program Files\Microsoft SQL Server\80\Tools\Binn>bcp
"MYSYSTEM..cfgdevices" in D:\mytemp.csv -t , -k -c -T

It throws the following error.

Starting copy...
SQLState = 23000, NativeError = 515
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the
value NULL into column 'TaskFileName', table 'MYSystem.dbo.cfgDevices';
column does not allow nulls. INSERT fails.
SQLState = 01000, NativeError = 3621
Warning = [Microsoft][ODBC SQL Server Driver][SQL Server]The statement
has been terminated.

BCP copy in failed

So how can I do the export operation. Please help me asap

--
Posted via [url]http://dbforums.com[/url]