Another interesting Interview question “Can we call Stored procedure form Trigger in MS SQL”? What will be your answer YES or NO? Answer should always be “YES”.
You can call Stored Procedure from trigger. In this article we will go through a simple After Insert trigger as an example.
create trigger trg_Ins_CustTrigger on Customer
After Insert
AS
Declare @Name as varchar(100)
Declare @Address as varchar(100)
select @Name=Name, @Address=Address from inserted
exec CustDet @Name, @Address
I believe above code is self explanatory as the table and field names I have used is a clear English text.
If you have any question please post it in comment section.
1 comment:
It is very useful...
Post a Comment