Emil,
I use a similar process (shown below), except I do not save the results
to a text file.
Exec @return = master..xp_sendmail
@subject = 'Query Subject',
@query = '<database>.<owner>.<sproc>',
@recipients = '<email recipients>'
If you need to export the file, maybe DTS would be a better way? A DTS
job that creates a file and emails it can easily be scheduled.
TGIF+1/2
-----Original Message-----
From: Kackos Emil
[mailto:mssqldba-ezmlmshield-x69257126.[Email address protected]
Sent: Friday, April 27, 2007 9:42 AM
To: LazyDBA Discussion
Subject: Save query results to File
Hello and happy Friday!
I want to run a scheduled task that produces a list, save the results to
a file and send that file to a person via email all in one shot.
I can already send emails via scheduled tasks.
Is it possible to run a query, save the result to a text file and send
that text file via email?
It's going to run as a scheduled task, so it can't prompt for path and
filename.
Thanks!
Emil
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
MS Sql Server LazyDBA home page