Quick Search

How use trigger in sql

February 27th, 2010 by admin
Leave a reply »

 

Example of Delete trigger

CREATE trigger [TRIGGER_Deletesubcategory] ON dbo.category

FOR delete

AS

declare @nmid int

select @nmid=sno from deleted

delete from subcategory where cat_id= @nmid

There will be two table one is category and second one is subcategory and the primery key of category table will be sno and the this will foreign key(cat_id) for subcategory table.

Posted in Database

You can follow any responses to this entry through the RSS 2.0 Feed. You can leave a response , or trackback from your own site.

Leave a Reply