Database Trigger doesn't save -
i'm new triggers. i'm trying write trigger using sql server 2014. here code
create trigger deletetrigger on student delete delete [stu-course] [stu-course].sid in ( select deleted.sid deleted ) go
i right click on database triggers in path mydatabase ->programmability ->database triggers , select new database trigger , write code there. doesn't save; , when click on database triggers again , there no sign of trigger. should do?
the reason can't find under database triggers
folder it's dml trigger, not database trigger (these ddl triggers).
note create trigger
page on msdn:
server-scoped ddl triggers appear in sql server management studio object explorer in triggers folder. folder located under server objects folder. database-scoped ddl triggers appear in database triggers folder. folder located under programmability folder of corresponding database.
if have executed create trigger script, , did not errors (the syntax looks ok me), should find under triggers folder of student
table.
however, operation attempting using trigger better handled using on delete cascade
on foreign key constraint between students
table , stu-course
table.
Comments
Post a Comment