June 25, 2003 at 6:21 am
How do you run a stored procedure and direct its output to a text file or even an nvarchar string?
Thanks
June 25, 2003 at 6:34 am
are you trying to do this once in a while or every time an sp fires?
June 25, 2003 at 7:54 am
One option would be to execute the stored procedure via OSQL and then use the -o option to output the results to a file.
You can also get the output into a table doing something like this:
Create table #output (output varchar(1000))
insert into #output exec(your_sp)
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
June 25, 2003 at 8:08 am
I need to do this everytime the sp fires. In fact the sp is going to be scheduled as a job. The result is to be emailed.
June 26, 2003 at 7:51 am
I have a weekly scheduled job that has 3 steps using procs to update a database. 3 more steps, each using isql to extract data from the tables updated to text files. Another step to zip the text files and the last step to email.
You could some similar to this.
Far away is close at hand in the images of elsewhere.
Anon.
June 27, 2003 at 4:59 pm
Thanks for your suggestion. I have decided to use the isql as suggested.
June 29, 2003 at 8:19 pm
DavidBurrows, which email system do you use mapi, CDONTS, SQL Server, etc. ?
Any suggestions
June 30, 2003 at 5:49 am
SQL7 SP4 xp_sendmail with Outlook 2000. Could not use cdosys and SMTP as the email has to be sent externally and our Exchange server does not act as a relay for security reasons.
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply