Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sql server.  EXECUTE msdb.dbo.sp_send_dbmail = ‘HRMail’, = =

Similar presentations


Presentation on theme: "Sql server.  EXECUTE msdb.dbo.sp_send_dbmail = ‘HRMail’, = ="— Presentation transcript:

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


Download ppt "Sql server.  EXECUTE msdb.dbo.sp_send_dbmail = ‘HRMail’, = ="

Similar presentations


Ads by Google