G Y

G Y

  • 1.5k
  • 229
  • 44k

Update trigger to be initiated, when there is any change on any column

Jan 16 2021 10:18 AM
Update trigger to be initiated, when there is any update on any column in dummytable other than ModifiedDate and UserModified column changes (update trigger should not consider the changes on ModifiedDate and UserModified columns)
  1. CREATE TABLE [dbo].[dummytable](  
  2. [ID] [intNOT NULL,  
  3. [code] [varchar](50) NULL,  
  4. [codevalue] [varchar](50) NULL,  
  5. [codedescription] [varchar](50) NULL,  
  6. [IsAdmin] [bitNULL,  
  7. [FirstName] [varchar](50) NULL,  
  8. [LastName] [varchar](50) NULL,  
  9. [createdUser] [intNULL,  
  10. [CreatedDate] [datetime] NULL,  
  11. [UserModified] [intNULL,  
  12. [ModifiedDate] [datetime] NULL,  
  13. PRIMARY KEY CLUSTERED  
  14. (  
  15. [ID] ASC  
  16. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ONON [PRIMARY]  
  17. ON [PRIMARY]  
  18. GO  

Answers (3)