1

I have a small issue with using bcp import tool. This is the case I have a .csv data file (field separator if | character) and format file. I can import data into the table successfully, but it is importing NULL value instead of empty strings in data file. consider below as sample record in data file

col1|col2|||col5|col6

I got output like below

col1 col2 NULL NULL col5 col6

but I am expecting below output

col1 col2  (empty string) (empty string) col5 col6 

in my table definition, default values are empty string, is this due to an issue with data file (bcp data exporting command) or my data importing bcp command.

this is the command I used to import data bcp [database].[table] in M:\data\xx.csv -f M:\format\XX.FMT -S serverName -T

Thanks and All reply are welcome.

4

2 回答 2

0

I believe you have to create the column of the table to have default value empty string ""

For example:

create table mytable (
  col1 varchar(10) default ""
)
于 2012-10-11T12:11:18.230 回答
0

You can update from the interface in management studio In the editor properties of the column Default Value or Binding : (' ')

于 2013-12-23T20:56:07.867 回答