Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

Exporting Select Query to CSV File

Question:
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?

Answer:
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.

 

 

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