January 24, 2002 03:24 PM

Using bcp to Copy a Result Set to a File

Rating: (0)
SQL Server Magazine
InstantDoc ID #23502

Can I use bulk copy program (bcp) to copy the result set of a stored procedure to a file?

Absolutely. Imagine that you've defined a procedure in Northwind called BcpOutOrders. The following command copies the data to a text file called authors.txt:

Bcp "EXEC northwind..BcpOutOrders"
QUERYOUT authors.txt —Usa —Ppassword
—Sserver —c
The...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

The links in your article take you to a page on MySQL and another Ad by HP. Kinda tacky don't you agree?

John7/15/2008 3:08:33 PM


When you want to use it in T-SQL to export using EXEC xpcmdshell bcp ...

Anonymous User 1/24/2005 2:35:22 PM


DIDN't GET EVAN A LITTLE HELP

Anonymous User 10/31/2004 9:00:46 PM


Great Tip. However, the DBA I work for is wondering why this would be used instead of DTS ( except for the possibility of better performance with BCP ). ??
Randy

Randall Petty 2/1/2002 10:20:39 AM


You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS