Kelvin Phayre
Ten Centuries
Points: 1358
More actions
July 27, 2009 at 7:16 am
#134615
Can anyone tell me how I could get all my fields to be not only comma separated but quote (") delimited.
i.e.
current output
FRED,SMITH,3 THE STREET,ANYWHERE
preferred output
"FRED","SMITH","3 THE STREET","ANYWHERE"
Only sqlcmd usage allowed.
jonathan.greenstreet
SSC Rookie
Points: 47
May 11, 2012 at 1:40 am
#1486132
You could try and use the QUOTENAME function or add double quotes around the fields
sqlcmd -S localhost -E -Q "select '""' + [name] + '""', QUOTENAME ([number], '""'), QUOTENAME ([type], '""') from spt_values" -o "Test.csv" -h-1 -s"," –W
I have not found a way with the sqlcmd options yet.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply