Create Trigger while update any column of table



CREATE TRIGGER trgAfterContractDeedFileURLUpdate ON  [Contract]
FOR UPDATE
AS
begin
    declare @BusinessUnit nvarchar(50)
    set @BusinessUnit = 'Insert To ContractDeedUrlHistory if Contract Deed URL is updated.'

    insert into
        ContractDeedUrlHistory(ContractNo,ContractDate, OwnerID,ContractDeedUrl,Entry_By,Entry_Date)
    SELECT
        ContractNo,ContractDate, OwnerID,ContractDeedUrl,Entry_By,Entry_Date
    FROM
        deleted
     
end

Comments

Popular posts from this blog

Provision AWS EC2 Instance and RDS with Terraform, and Deploy Spring Boot App to EC2 Instance via GitHub Action Pipeline

JQuery UI Autocomplete, custom HTML structure for result?

Easy Ui Jquery easyui-textbox change onChange event