SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sending Email in SQL Server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ranjit.ileni
Posting Yak Master

India
182 Posts

Posted - 02/09/2013 :  01:49:53  Show Profile  Reply with Quote
Hi Experts,


if I run one Query then I will get this result:
Assume,
select responsibleprovider ,emailaddress from table1
responsibleprovider emailaddress
aaaa, bbbbb aaaar@uphs.upenn.edu
ddddd, Pppp ddddp@uphs.upenn.edu



if I run another query I get this result:
Assume,
select Count ,responsibleprovider from tablereport

Count responsibleprovider
6 aaaa, bbbbb
8 ddddd, Pppp

I need to send this people email about the number of reports waiting for them (knowing their email address from the previous SQL):

For example, contact Email will get email: You have 1 report
aaaa, bbbbb will get email: You have 4 reports

I am new to Mail functionality in SQL Server ,
Could you please advice me , how to send an mail to repective preoviders with some text.

Thanks!

--Irk

Edited by - Ranjit.ileni on 02/09/2013 01:51:13

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2079 Posts

Posted - 02/09/2013 :  06:52:34  Show Profile  Visit jackv's Homepage  Reply with Quote
SQL Server comes with Database Mail. Use this article to assist in setting up Database Mail , which will allow you to send email from within your sql statements. You will need a valid smtp address to which you can point
http://www.sqlserver-dba.com/2011/01/set-up-database-mail-on-sql-server-2005.html

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 02/09/2013 :  08:24:56  Show Profile  Reply with Quote
you can also implement this in ssis using send mail task. Just add a connection to your email server and it will sent the mail.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000