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 SinghPosted Jan 16, 2021, 11:16 AM
G YPosted Jan 16, 2021, 11:10 AM
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 practiceSachin SinghPosted Jan 16, 2021, 10:55 AM