Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 BCP Utility

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-17 : 08:03:20
Babak writes "I am trying to bulk copy to a file from a database table. Here is what I am using:

SET @bcpCommand = 'bcp "SELECT * FROM PPV_test" queryout "'
SET @bcpCommand = @bcpCommand + @targetpath + @filename + '" -S servername -U user -P password -w'

Is it possible to use a stored procedure instead of a query (Select ...) in bcp in the above statement? If so, what is the syntax? "

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-09-17 : 08:03:52
Certainly:

SET @bcpCommand = 'bcp "EXECUTE myStoredProcedure" queryout "'
SET @bcpCommand = @bcpCommand + @targetpath + @filename + '" -S servername -U user -P password -w'

Go to Top of Page
   

- Advertisement -