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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute SP from SP

Status
Not open for further replies.

StormbringerX

Programmer
Dec 14, 2000
102
US
Hi all,

I'm relatively new to Stored Procedures and have a question.

I have 2 stored procedures. One replaces some data in all rows that match the criteria:

IF @NewSched > ''
BEGIN
IF @All > '' Begin
UPDATE Acreage
SET Schedule = @NewSched
WHERE Parcel = @ParcelNo
End

Else
UPDATE Acreage
SET Schedule = @NewSched
WHERE Parcel = @ParcelNo AND Schedule = @Sched
End

This works exactly as I need. I also have another stored procedure that operates on this same table on a single row basis. It recalculates a single record.

What I'm trying to accomplish is executing the second stored procedure from the first stored procedure on each row.

Looking at the above snippet, what I want to do is each time the Acreage file is updated, regardless of the number of records, I would like to execute the second SP that recalculates that particular record.

I know I can execute the SP by using sp_exec, but it seems that no matter where I place it in the above code, only the last one is recalculated.

I hope I have explained this well enough.
Thanks for your time...

Dave


 
You may want to incorporate your 2nd SP in an UPDATE Trigger.

Thanks

J. Kusch
 
I just looked up triggers (told you I was new to this!) and it sounds like exactly what I need. Thanks J!

Dave
 
I tried to send you a star but I kept getting javascript errors...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top