Gagri Global IT services is having a team of executives who have good experience in developing applications on various platforms like SharePoint 2013/2010, Silverlight, net Framework 4.5 and Mobile tools.

Trigger implementation guide

Posted on August 24, 2023 by Upendra

This trigger updates the expiry date based on the Approved date plus No.Of_days

Trigger Functionality:

When an update occurs in the table, the trigger is activated. It calculates the new Exdate based on the Approved Date plus the period specified in the No.of_days column. The trigger updates the Exdate column in the table accordingly.

Query

            
                CREATE TRIGGER Trigger_Name
                ON Table
                AFTER UPDATE
                AS
                BEGIN
                -- Calculate the new expiry date based on the ApprovedDate + No.of_days
                UPDATE M
                SET ExDate = DATEADD(DAY, CAST(No.of_days] AS INT), i.ApprovedDate)
                FROM Table M
                INNER JOIN inserted i ON M.[ID] = i.[ID]
                INNER JOIN Table1 T ON M.[TID] = T.[TbNumber]
                WHERE M.[TbNumber] = i.[TbNumber] AND i.[TID] = M.[TID];
                END;
            
  
foot-logo

All design and content Copyright © 2012-2018 Gagri Global IT Services Pvt.Ltd. All rights reserved

Sitemap