question

Gehima2016 avatar image
Gehima2016 asked

Stored Procedure development

I was assigned a task to automate a notification alert to inform managers to send checklist of terminated employee to security admin within 5 business days of effective termination of employee(s). Below is the stored procedure to be modified to perform this task. Please, I am baby developer. I need assistance as to developing the right code to do the job. CREATE PROCEDURE [dbo].[sp_TerminationChecklist] AS Declare @Rec_Count int select @Rec_Count=count(*) from employee where TerminationDate>dateadd(dd,-1,getdate()) if @Rec_Count=0 EXEC master.dbo.xp_sendmail @recipients = 'TerminatedEmployeeManager', @message = 'There were no terminations for the previous workday', @width =355, @copy_recipients = 'aa12', @subject = ' DatabaseName - List of terminated employees', @dbuse = 'DatabaseName' else EXEC master.dbo.xp_sendmail @recipients = 'TerminatedEmployeeManager', @message = 'Please, send checklist of Terminated Employees to Security Admin with 5 day of effective termination of employee ', @query = 'select TerminationDate,EmpFirstName, EmpLastName,lanid from tblemployee where DateTerminated>dateadd(dd,-1,getdate()) order by DateTerminated desc', @width =355, @copy_recipients = 'aa12', @subject = ' DatabaseName - List of terminated employees', @dbuse = 'DatabaseName'
developmentsp
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Moden avatar image Jeff Moden commented ·
I guess I don't understand why you don't just send the terminations directly to the termination manager.
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.