dbTalk Databases Forums  

Results from Stored Procedure to txt file?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Results from Stored Procedure to txt file? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Elizabeta
 
Posts: n/a

Default Results from Stored Procedure to txt file? - 12-17-2004 , 12:57 AM






Anybody can give me a directions how to get the results form a stored
procedure (all SELECT it is a report thing) and put it in txt file and send
in a email ...

TIA

Reply With Quote
  #2  
Old   
Kornel Kasprzyk
 
Posts: n/a

Default Re: Results from Stored Procedure to txt file? - 12-17-2004 , 09:31 AM






Użytkownik "Elizabeta" <Elizabeta (AT) discussions (DOT) microsoft.com> napisał w
wiadomości news:1EA3EC3B-152D-42BD-B918-E37A14BC9E78 (AT) microsoft (DOT) com...
Quote:
Anybody can give me a directions how to get the results form a stored
procedure (all SELECT it is a report thing) and put it in txt file and
send
in a email ...

TIA
Hi,
If You use MS SQL Database, I suggest You to use xp_SendMail functionality.
Xp_SendMail allows You to send the result of query as a text file
attachment.
Below, there is a part of MS Transact SQL Reference describing this
solution:
"
D. Send results as an attached file
This example sends the results of the query SELECT * FROM
INFORMATION_SCHEMA.TABLES as a text file attachment to Robert King. It
includes a subject line for the mail and a message that will appear before
the attachment. The @width parameter is used to prevent line breaks in the
output lines.

EXEC xp_sendmail @recipients = 'robertk',
@query = 'SELECT * FROM INFORMATION_SCHEMA.TABLES',
@subject = 'SQL Server Report',
@message = 'The contents of INFORMATION_SCHEMA.TABLES:',
@attach_results = 'TRUE', @width = 250
"
Rgds.,
Kornel.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.