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 help

Author  Topic 

sqldba2k6
Posting Yak Master

176 Posts

Posted - 2007-03-03 : 11:12:25
I have created a stored procedure which will extract data.Now i want the data to be expored to a text file.I never used the bcp.
How can i use the stored procedure using the bcp..
I am not passing any parameter to stored procedure.

Please help me..Thanks for your help in advance..

X002548
Not Just a Number

15586 Posts

Posted - 2007-03-03 : 12:09:38
You need to execute the sproc and store into a table, then bcp out the table

INSERT INTO Table EXEC Sproc



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-03-03 : 12:18:50
if you use the queryout option in bcp, you can call the sproc directly from bcp:

bcp "exec MyDatabase.dbo.spGetData" queryout file.txt -c -T -SMYSERVER

see also: http://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/




www.elsasoft.org
Go to Top of Page
   

- Advertisement -