I’m thinking that this is pretty easy to do. Say I have the following query:
select QUOTENAME(countNumber as [Count Number],'"'), QUOTENAME(testValue,'"') as [Test Value] from tblTestResults
I get my results surrounded by double quotes – good. But now when I choose “Save as”, not only do I want the headers, but I want them surrounded by double quotes as well in my resulting csv file. I saw (from another stackoverflow question) that there should be an option to select headers in Tools > Query Results. But I don’t seem to have that in mine. Thoughts?
Also, I’m using Microsoft SQL Server 2008 (SP1) – 10.0.2531.0 (X64)
Yields this:
If you click in the top-left corner of the grid output (so all rows are selected), you can right-click and select “Copy with Headers” … this will copy the headers with the quotes as per above.
Query > Results to File should show these headers with double quotes as well (but not Save Results As for some reason – it doesn’t include the headers).