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.