|
Posted by Plamen Ratchev on 05/24/07 12:38
One way is to use the extended stored procedure xp_sendmail. It does require
that you have a MAPI profile and SQL Mail configured. Then it can be used
like this:
xp_sendmail
@recipients = 'email@domain.com',
@subject = 'Query Results',
@query = 'SELECT fname, lname FROM Employees WHERE empid = 9'
In the above example the results of the query will be included in the e-mail
message. Read in SQL Server Books OnLine more about the additional
parameters for xp_sendmail. They control how the query is executed (database
context, database user) and how it is displayed (headers, formatting, attach
query results in a file).
Here is more info on configuring SQL Mail:
http://support.microsoft.com/kb/q263556/
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Navigation:
[Reply to this message]
|