export proper csv from SqlServer management studio query result

See Options > Query Results > SQL Server > Results to Text

Check "include column headers". My text results are being enclosed in doublequotes so that should take care of the comma issue. Take a look at the "Results to grid" tab as well - I see a "Quote strings containing list separators when saving .csv results"

If not through SSMS then you can also use the sqlcmd command line utility which includes more options than the powershell equivalent.


Not through Management Studio, but you can do this with the powershell integration in 2008. right-click in the object explorer and click "Start Powershell", then:

Invoke-Sqlcmd -ServerInstance '.\sqlexpress' -Database 'temp' -Query "select * from t" | Export-Csv file.csv -notype