How to get export output in “real” CSV format in SQL Server Management Studio?

前端 未结 12 977
梦谈多话
梦谈多话 2020-12-04 07:57

I have a query that I am running in SQL Server Management Studio (connecting to a SQL Server 2005 database). I want to export the data in CSV format. Not wannabe CSV format,

12条回答
  •  执笔经年
    2020-12-04 08:40

    In SSMS 2012 there's an option for this, in Tools -> Options -> Query Results -> SQL Server -> Results to Grid, it's called "Quote strings containing list separators when saving .csv results". I don't know how long such an option has existed for, but I'm baffled by two things:

    1. How come it's not turned on by default
    2. How come it's an option and not an intrinsic part of the CSV exporting code

    It just defies belief that the default behaviour is to have CSV export that's impossible to import properly. I've noticed Excel does the same, I'll have to go see if that's got an option too.

    In the mean time, thanks to my colleague who pointed me to this bizarre bit of functionality when I was ranting about how the CSV exporter was completely useless, and this was the best link I'd found about it so I thought I'd put the knowledge here for the benefit of future searchers.

    UPDATE

    A screenshot below:

提交回复
热议问题