Let me explain my requirement briefly. I have a table called compliant which stores compliant posted by users. When a new compliant is posted, then status of that compliant will be "Opened". Similarly once the compliant is resolved by the support team they will set the status of compliant to "User to Confirm". If user is satisfied then he/she can set the compliant status into "Closed". If user missed to change status as "Closed", once it has resolved then after 48 hours compliant status should set to "Closed" and also an automated mail should sent to user regarding status of that compliant.
I have created an stored procedure which display all compliant along with user details, which are resolved before 48 hours whose status to be changed to "Closed". Now from c# application I will send mails to all those users. Then I am calling another stored procedure to update status of the compliant as "Closed", which takes compliant number as parameter.
Can anyone help me to write both sql statements (selecting compliants and updating compliant status) inside a single stored procedure? Also I want to know is it required to use transaction in my case?