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
 SQL Server Development (2000)
 Save results on file From Proc

Author  Topic 

cshekar
Starting Member

49 Posts

Posted - 2001-12-11 : 14:16:04
wrote a Stored procedure where it is selecting all the rows from the table.
I wanted save those results in to the file for example
I wanted save the results as C:\SaveProcresults\ **.sql or txt
is that posible or not is there any function with in Stored procedure
use as save results in file.

Thanks

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-12-11 : 14:31:33
You could use BCP, which is a command-line command. It could be executed from within a stored procedure by calling master..xp_cmdshell (if that procedure hasn't been blocked from use).

-------------------
It's a SQL thing...
Go to Top of Page

SKIBUM
Starting Member

32 Posts

Posted - 2001-12-11 : 14:46:58
Use Query Analyzer.

Before Executing your Stored Procedure, click in the Query Menu, then Results to File...(ctrl+shift+F).

This will save your results to a txt file :)

Good luck!

Go to Top of Page

cshekar
Starting Member

49 Posts

Posted - 2001-12-11 : 16:17:51
I am not asking from Query Analyzer
I wanted to know within Stored proc is any way that I can mention
save out file as because all my stored proc execute automatic in a package so all the out put I wanted save in a file.
Thanks
Chandra


quote:

Use Query Analyzer.

Before Executing your Stored Procedure, click in the Query Menu, then Results to File...(ctrl+shift+F).

This will save your results to a txt file :)

Good luck!





chandra shekar
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-11 : 16:20:40
Mark's suggestion to use bcp is a perfect idea.

Edited by - robvolk on 12/11/2001 16:20:58
Go to Top of Page
   

- Advertisement -