| Author |
Topic |
|
Plotin
Starting Member
21 Posts |
Posted - 2005-12-05 : 19:52:59
|
Hi Out ThereThe attempt to create the following stored procedure, which is supposed to call the previously created stored procedures inside it,causes the following errors.Server: Msg 137, Level 15, State 2, Line 1Must declare the variable '@OfferIDTwo'.Server: Msg 137, Level 15, State 2, Line 1Must declare the variable '@OfferIDThree'.Server: Msg 137, Level 15, State 2, Line 1Must declare the variable '@OfferID'.Server: Msg 137, Level 15, State 2, Line 1Must declare the variable '@OfferID'.Server: Msg 137, Level 15, State 2, Line 1Must declare the variable '@OfferID'.Server: Msg 137, Level 15, State 2, Line 1Must declare the variable '@OfferID'.Create Procedure spPrepareOfferSimulation@OfferIDOne intAs exec spPopulateOfferTables @OfferIDgoexec spPopulateOfferProduct @OfferIDgoexec spPopulateOfferDictionary @OfferIDgoexec spPopulateOfferCondition @OfferIDgoexec spPopulateOfferError @OfferIDgoexec spPopulateOfferLimit @OfferIDgoexec spPopulateOfferQA @OfferIDgoCan someone provide me with some productive input to fix this mess? |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-12-05 : 19:59:08
|
| Remove all but the last "GO" from your procedure. GO is not a SQL command, it is a batch separator. It signals the end of the CREATE PROCEDURE batch, that's why you're receiving the error. |
 |
|
|
activecrypt
Posting Yak Master
165 Posts |
Posted - 2005-12-05 : 23:52:21
|
| Hi,* CREATE PROCEDURE * refer this topic from BOL .:-)RegardsAndy DavisActivecrypt Team--------------------------------------------SQL Server Encryption Softwarehttp://www.activecrypt.com |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-06 : 00:00:18
|
| Why do you want to call multple procedures inside a procedure?. Instead call them seperatelyMadhivananFailing to plan is Planning to fail |
 |
|
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2005-12-06 : 00:08:39
|
| >>Why do you want to call multple procedures inside a procedure?.Network overheadDavidMIntelligent Design is NOT science.A front-end is something that tries to violate a back-end. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-06 : 03:57:03
|
| "Why do you want to call multple procedures inside a procedure?"We do this to split large Sprocs so that the individual parts can have separate cached query plansKristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-06 : 04:04:28
|
Well. That sounds good MadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-06 : 04:53:44
|
| Actually "large Sprocs" is probably the wrong definition. We more normally use this approach where an Sproc has a number of different execution paths, and we don't want the cached query plan to favour any particular "logic route" though the SProc.IF @foo = 'BAR' EXEC dbo.SomeOtherSproc_AIF @bar = 'FOO' EXEC dbo.SomeOtherSproc_Band so onKristen |
 |
|
|
Plotin
Starting Member
21 Posts |
Posted - 2005-12-06 : 07:55:47
|
| Followed your advice robvolk and it works just fineThanks to all of you for your inputPlotin |
 |
|
|
Plotin
Starting Member
21 Posts |
Posted - 2005-12-06 : 08:01:27
|
| Hi madhivananThe reason I am calling multiple store procedures from one is simply to learn about nested stored procedures.Every individual stor proc populates a table,necessary to be done in order to do some work on them.Later on I will do all this work to be done from one stor proc and compare the performance of it against the approach of call individual ones from a single stor proc. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-07 : 00:53:36
|
| Thats really goodMadhivananFailing to plan is Planning to fail |
 |
|
|
|