Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: SQL Server
Expertise: Beginner
Nov 20, 1998



Application Security Testing: An Integral Part of DevOps

Exporting Select Query to CSV File

Using the following SQL statement, I could export a select query into a dbf file at c:\temp\test.dbf

INSERT INTO test IN 'C:\temp' 'DBASE IV;' SELECT * FROM Table1

How would I write a SQL statment to export the same select query to a CSV (comma separated) file?

Transact SQL does not support importing or exporting from a file. However, SQL Server provides you several ways to do so. The BCP command, which is run from the command prompt, not ISQL, allows you to both import and export data from a table. The online help has a complete description of all the options.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date