I know this can be done using DTS however I would like to know how I can output data in csv format using a query if the columns contain nulls?
For example, if you create and insert into the following table then try to output to a comma seperated string the values get truncated:
create table testcol(
col001 varchar(10),
col002 varchar(10),
col003 varchar(10))
insert into testcol values('A','B','C')
insert into testcol values('A','B',NULL)
insert into testcol values('A',NULL,'C')
insert into testcol values(NULL,'B','C')
insert into testcol values('A',NULL,NULL)
select col001 +','+ col002 +',' col003
from testcol
col003
A,B,
A,B,
NULL
NULL
NULL
Thanks as always.