You are here: Re: Query result sent via e-mail « MsSQL Server « IT news, forums, messages
Re: Query result sent via e-mail

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация