I'm bcp-ing a table to a file. I've noticed that if a varchar column is empty, that both "bcp -c" and "bcp -c -k" export the empty value as #$00. Instead, I'd like to export the value as if it were null.
create table tab1 (
myColumn varchar(10) null
insert into tab1 (myColumn) values ('')
exec master..xp_cmdshell 'bcp monkey..tab1 out D:\data.csv -c -T'
drop table tab1
I've been fiddling about with other switches but so far haven't come up with a solution other than writing out the full SELECT-statement or updating the original. Anyone with an easier solution?