how to save a trigger in sql server enterprise manager studio
i can right cl开发者_如何转开发ick on a table and go to the Triggers folder and click "New Trigger". I can then fill out the SQL for the trigger but when i click save, it just wants to save it to a ".sql" file.
How to i "commit" this trigger to the table ?
EDIT:
as per my comment below, i did hit execute but it wasn't showing up in the "Triggers" folder. It looks like you have to click "Refresh" for it to show up.
Hit Execute
or F5
You just run the trigger, it should start with CREATE TRIGGER, so just hit execute
The code that is generated is "CREATE TRIGGER" code... when you put your trigger inside, you need to execute (F5) this entire query, which saves it to the database. Then click on the 'Triggers' folder for the table and hit F5 again to refresh, and you'll see your trigger.
SQL Server Management Studio is simply providing you with a template for a Create Trigger script. You must run the script on the Database Server for it to actually modify your Database.
精彩评论