I thought we were saying something like this would work
ALTER TRIGGER [dbo].[BadUpdate]
ON [dbo].[SomeTable]
INSTEAD OF UPDATE
AS
BEGIN
IF EXISTS (
SELECT 1 FROM dbo.Foo
WHERE Field IN (
SELECT inserted.Field
FROM inserted
WHERE inserted.IsActive = 0))
BEGIN
RAISERROR ('Illegal move game master' ,16,1)
ROLLBACK TRANSACTION
END
ELSE
UPDATE dbo.SomeTable
SET
[Name] = inserted.Name
WHERE [Id] = inserted.Id
END
GO
That did not work. the Update does not change the field name
UPDATE dbo.SomeTable
SET
[Name] = inserted.Name
WHERE [Id] = inserted.Id
I have an error saying inserted is not a good alias