SQLTeam.com | Weblogs | Forums

Sql 2008 export table csv with headers and data

Hi guys,

I'm really a newbie in SQL, I hope you can help me with this.

I need to export a table in SQL 2008 with headers and data delimited with | ( pipes ), but some information inside of this table have , ( comma ) and CR or LR, it's possible to put it a "" in that ???

I try to export with Export tool provide by SQL but don't have the option to put "" in that.

Thanks so much !!!

Kind regards.

If you are using pipe as the delimiter - there shouldn't be any requirement to quote the contents in the output file. If there are embedded carriage returns and/or line feeds (CR, LF or CRLF) then those should be replaced prior to export as they can cause issues with the file.

The export wizard does have an option for quoted identifier - you can put any valid character into that field. Generally the double-quote is used there and all columns will be quoted.

If you only want specific columns - you can use QUOTENAME in the query with the second parameter defined as the double-quote.