August 9, 2010 at 1:28 pm
I'm just getting started with SQL & the Management Studio and need to create a trigger.
I've clicked on "Trigger" under the table I want the trigger to apply to and clicked "New".
In the editor I've created a simple trigger and it executes properly. When I save the trigger
code it is put in my "projects" directory.
How do I associate the trigger I've written with the database? It doesn't appear under the "Trigger" heading under the Object Explorer.
Thanks for any help.
August 9, 2010 at 1:45 pm
Refresh Object Explorer. It doesn't refresh automatically.
There's no 'associating' a trigger with a object in a database. When you create a trigger, you specify what table it's created on as part of the definition of the trigger:
CREATE TRIGGER AuditUpdates
ON SomeTable
AFTER UPDATE
AS
...
That ON SomeTable defines that this is a trigger on the table named 'SomeTable'
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 9, 2010 at 2:54 pm
Gail:
Thanks for your quick response.
The refresh didn't work, but after your post I decided to shut SS Mgmt Studio down and bring it up again and voila the trigger appeared.
Thanks again.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply