Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i need to send an email using a stored procedure to notify an email id about the error.and the mail id receipients are to be taken froma table .plz guide me over this.
Posted
Comments
_Asif_ 30-Apr-14 2:53am    
What have you done so far?

1 solution

Read this blog
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104042[^]

Solution as per blog

SQL
DECLARE @Receipientlist varchar(8000)
SET @ReceipientList = STUFF((SELECT ';' + emailaddress FROM Your query here FOR XML PATH('')),1,1,'')


EXEC sp_send_dbmail @profile_name= your email profile in db,
@recipients=@Receipientlist,
@subject='your subject here',
@body='body message here'
...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900