I have a table which has a list of ticket owners and and tickets which are assigned to them which are of high priority.
For example:
I need to send mail from SQL Server using sp_send_dbmail
to John with all the tickets assigned to him in a single mail. This is a huge table so I want send mails to users with their assigned tickets in single mail instead of sending one mail per ticket. Any help would be appreciated.
Best Answer
Below is how you do it ...
Create table and add
processed column
Use below query
Use above query to send HTML email using database mail.
Update the
dbo.Tickets
table andset processed = 1
for the owners that you emailed the tickets.Note: you can use case statements based on the owners and email them seperately.
This is a pseudo code that will help you 80% in what you want to achieve.