How to track column value change in sql server


CREATE TRIGGER [dbo].[TGRName]
ON [dbo].[TableName]
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
IF (UPDATE([ColumnName]))

INSERT INTO [TableName]([Columns]....)
Select distinct [Columns]....
from INSERTED I
INNER JOIN Deleted D ON D.Id= I.Id
WHERE I.[ColumnName] <> D.[ColumnName]

SET NOCOUNT OFF

END

Comments

Popular posts from this blog

List of special Characters in HTML

How to Read TOC Headings from word document using C#