Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Stored Procedure

Status
Not open for further replies.

dabdo555

Programmer
Dec 3, 2003
15
US
I have an 'instead of update trigger' for a view. I would like to call a stored procedure from this view. I put the code into the trigger, I know the procedure works, Ive tested/executed it. But the trigger doesn't execute it. Here is what the update kind of looks like...

ALTER TRIGGER InsUpTrg_vwPIWDB on dbo.[PIW DB]
INSTEAD OF Update
AS
BEGIN


UPDATE dbo.[tblPIW_DB1] SET
[Address] = i.[Address],
.....
from inserted i
WHERE dbo.[tblPIW_DB1].[prop_num] = i.[prop_num]

UPDATE dbo.[tblPIW_DB2] SET
[Payment Term] = i.[Payment Term],
.....
from inserted i
WHERE dbo.[tblPIW_DB2].[prop_num] = i.[prop_num]

--here is the stored procedure call
declare @prop_num int
select @prop_num=i.[prop_num] from inserted i
exec pCalcFinancial @prop_num

I have tried applying this procedure call on the two tables that are in the view individually. It works but if the user updates fields that are in both table 1 and table 2 they get an error stating the record is being updated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top