Download presentation
Presentation is loading. Please wait.
Published byRosamond Carson Modified over 9 years ago
1
Sql server
2
EXECUTE msdb.dbo.sp_send_dbmail @profile_name = ‘HRMail’, @recipients = ‘Gregory.House@adventureworks.com’, @copy_recipients = ‘Administrator@adventureworks.com’, @body = ‘Your data has been successfully imported!’, @subject = ‘Import Notification Message - Success’;
3
EXECUTE msdb.dbo.sp_send_dbmail @profile_name = ‘HRMail’, @recipients = ‘Lisa.Cuddy@adventureworks.com’, @blind_copy_recipients = ‘Gregory.House@adventureworks.com; Administrator@adventureworks.com’, @body = ‘Per your request, here are the employees hired in 2002.’, @query = ‘SELECT Person.Person.FirstName AS First, Person.Person.LastName AS Last, HumanResources.Employee.HireDate AS [Date of Hire] FROM Person.Person INNER JOIN HumanResources.Employee ON Person.Person.BusinessEntityID = HumanResources.Employee.BusinessEntityID WHERE HireDate > ‘’2002-01-01" AND HIREDATE < ‘’2003-01-01’’ ORDER BY HireDate’, @execute_query_database = ‘AdventureWorks2008’, @subject = ‘Employees Hired in 2002’, @attach_query_result_as_file = 1;
4
SELECT * FROM msdb.dbo.sysmail_mailitems EXECUTE msdb.dbo.sysmail_delete_mailitems_sp @sent_before = ‘January 31, 2009’ ; EXECUTE msdb.dbo.sysmail_delete_mailitems_sp @sent_status = ‘failed’;
5
sp_send_dbmail @profile_name, @recipients, @copy_recipients, @blind_copy_recipients, @subject, @body, @body_format, @importance, @sensitivity, @file_attachments, @query, @execute_query_ Database, @attach_query_result_ as_file, @query_attachment_ filename
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.