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
 Import/Export (DTS) and Replication (2000)
 job results e-mail

Author  Topic 

mannymo
Starting Member

1 Post

Posted - 2003-10-15 : 13:21:19
I have a job setup that runs sp_spaceused. How can I e-mail the results of the job?

nr
SQLTeam MVY

12543 Posts

Posted - 2003-10-15 : 13:26:49
This returns 2 resultsets. It's easier to create your own sp to return a single resultset and use that in sp_sendmail.
Actually it's easier to run 2 jobs - first puts result into a table the second emails it then you can keep a history on the server and set up alerts on the value.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-15 : 14:58:54
You could also run sp_spaceused using osql at a cmd window. You could send your results to an output file. Then e-mail the output file:

osql -SSomeServer -USomeUser -PSomepwd -Q"EXEC sp_spaceused" > C:\Temp\Something.txt
osql -SSomeServer -USomeUser -PSomepwd -Q"EXEC xp_sendmail @recipients = 'someone@hotmail.com', @attachments = 'C:\Temp\Something.txt"

You could then save this as a batch file so that you just have to double click on it.

Tara
Go to Top of Page
   

- Advertisement -