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)
- CREATE TABLE [dbo].[dummytable](
- [ID] [int] NOT NULL,
- [code] [varchar](50) NULL,
- [codevalue] [varchar](50) NULL,
- [codedescription] [varchar](50) NULL,
- [IsAdmin] [bit] NULL,
- [FirstName] [varchar](50) NULL,
- [LastName] [varchar](50) NULL,
- [createdUser] [int] NULL,
- [CreatedDate] [datetime] NULL,
- [UserModified] [int] NULL,
- [ModifiedDate] [datetime] NULL,
- PRIMARY KEY CLUSTERED
- (
- [ID] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- ) ON [PRIMARY]
- GO

Sachin SinghRank #66 · 26.2K reputationPosted Jan 16, 2021, 6:16 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Jan 16, 2021, 5:55 AM EST
G Y169 reputationPosted Jan 16, 2021, 6:10 AM EST
Sachin Singh
Yes, we can use UPDATE() but if there are more that 30 columns in the table then applying OR operator does not seems to be a good practice