I have a table with many columns but my snippet is simplified. I have the trigger shown below but how can I have it so that nothing is inserted if only the created_at
column has changed?
ALTER TRIGGER [dbo].[t_upd_insert]
ON [dbo].[Player]
FOR INSERT, UPDATE
AS
SET XACT_ABORT, NOCOUNT ON;
BEGIN
INSERT INTO dbo.Changes (
[name]
[created_at]
)
SELECT
ins.[name],
ins.[created_at]
FROM INSERTED ins
I could do a WHERE name != ins.[name]
for each column but there are a lot of columns and tables that need this; is there a shorter syntax?
EDIT
I've tried adding
WHERE
[name] != ins.[name] OR
[age] != ins.[age]
....
but that doesn't work either. I thought that would be the naive method but that doesn't work.
Best Answer