Share via

New Trigger and ENABLE TRIGGER

David Chase 681 Reputation points
2020-09-09T15:20:38.827+00:00

When I create a trigger for a table using SSRS it adds a line similar to below at end of trigger. Is this necessary on every new trigger? Below came up for a table named Diets.

END
GO
ALTER TABLE [dbo].[Diets] ENABLE TRIGGER [trgDietsAudit]
GO
Developer technologies | Transact-SQL
Developer technologies | Transact-SQL

A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.

0 comments No comments

Answer accepted by question author

tibor_karaszi@hotmail.com 4,321 Reputation points
2020-09-09T15:52:24.847+00:00

A trigger is enabled by default when you create it. You said that "it" added that ALTER TABLE, so the question is what this "it" is? :-) I assume some tool like SSMS or Azure Data Studio. But without such details or the whole picture all we can give you are generic replies, like this.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. David Chase 681 Reputation points
    2020-09-09T18:46:53.013+00:00

    The IT was the create trigger wizard in SSMS. I think you are right because I tried it both ways and both worked which leads me to believe that the ALTER TABLE part is not needed.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.