How to Delete a record only if it was created within 15 mins

Viewed 19

Hello I have a simple delete function but i want to implement an exception that this delete only runs if the record has been made within 15 mins interval of create date. So if its past the 15 mins then a user cannot delete and will return and error number back.There is a _createdon column that shows when the item is created and can be compared with the 15 mins.Thanks for your help.

CREATE PROCEDURE [rl].[usp_Item_Delete]  
    @ItemId INT,  
AS  
  
BEGIN  
  
    SET NOCOUNT ON;  
 DELETE   
 FROM rl.Item
 WHERE ItemId = @ItemId 
END  
0 Answers
Related