Passing value from stor oroc to Trigger [Resolved]

Posted by Shoyebaziz123 under Sql Server on 2/15/2012 | Points: 10 | Views : 2416 | Status : [Member] | Replies : 2
Hi All,
I have created a sp like this

ALTER PROCEDURE [dbo].[SP_WaterPH]
-- Add the parameters for the stored procedure here
@iReqDetailsId int =null
,@iReqSampleId int=null
,@iReqId bigint=null
.
.
.

now i am creating a trigger
like this

alter TRIGGER trgAfterUpdate ON [dbo].[tbl_RequisitionMaster]
FOR UPDATE
AS
Declare @iReqId bigint=null;
Declare @iReqStatus bigint=null;
Set @iReqStatus = (select min(reqdetailsstatus) as status from tbl_RequisitionDetails where ReqId=@iReqId);


now my problem is that how can i pass this " @iReqId " to trigger ?

any help please...

Thanks




Responses

Posted by: PandianS on: 2/15/2012 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Hi

1. Are you Updating the table "tbl_RequisitionMaster" inside the stored procedure "SP_WaterPH" ?

2. If so, The Trigger will be raised. So, You can access the column "ReqId" from the logical table called "DELETED" and you can access that value from that logic table inside the Trigger

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/15/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Triggers dont work like that

http://www.sqlteam.com/article/an-introduction-to-triggers-part-i

Look at that link

Thank you for posting at Dotnetfunda
[Administrator]

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response