Hi:I am building stored procedure that helps me find records older than 3 days and flagging those records. So, I can then, send an e-mail reminder to the Approvers than they have not yet approved those accounts. Please need help!!!!If @SQLType = 'S'BEGIN SELECT DISTINCT a.Unique_Identifier, a.Requestor_Name, a.Submitted, a.Submitted_by, a.Status, a.Authorized_by, a.Authorized_Datetime, a.flag, a.flag_date, a.Application_NameFROM DR_Authorization_Log_Velocity AS a INNER JOIN DR_Approver_Email_Accounts AS b ON a.Application_Name = b.Application_Name_ID INNER JOIN DR_Account_Approvers AS c ON c.UserId = b.Approver_UserIDWHERE (b.Email_Type = '3') AND (a.Status IS NULL) AND (a.Submitted < { fn NOW() } - 3)ORDER BY a.SubmittedEnd The Table looks like this:Unique_Identifier, Requestor_Name, Submitted, Submitted_by, Status, Authorized_by, Authorized_Datetime, flag, flag_date, Application_Name
Unique_Identifier--Requestor_Name---Submitted---Status----Flag--Flag_date--- Application_Name 100 John Smith 05/01/2009 'NULL' Requesting MS Excel
*For example in this case this record was selected because the record is older than 3 days and the Status is NULL. I have at least 50 of these records. I need script that reads record by record set the flag to 1 once read it and set the Flag_date to today. So, I can then pick it up on .Net and send out the e-mail. Thank you for your help!!!!!