Exporting SQL Server data to CSV

What is the fastest way to export SQL Server data to CSV with ALL column fields enclosed in double quotes, including numeric fields?

In the Management Studio results window, I can right click and select Save Results to CSV, but it does not include the fields in double quotes.

I have looked at similar questions , but the suggested solutions do not do what I want.

+2


source to share


2 answers


Use the bcp utility .



An example is here .

+2


source


Use QUOTENAME if you want double quotes around fields



Link to quotename

0


source







All Articles