sql server programming:
Greetings,
I have two stored procedures in SQL 2000.
Procedure 1 (procMfrGageLookup) - looks up an item by part number,
@MfrGageLookup, and returns the description, vendor, and price from the
tblMfrGages.
Procedure 2 (procMfrReplacedGageLookup) - looks up the above part number to
see if it has been replaced with a new part from the tblMfrReplacedGages.
After the user enters the part number (@MfrGageLookup), I have the
ReplacedGageLookup procedure check to see if it has been replaced with a new
part number, if so, replace @MfrGageLookup with the replacement part number
and lookup the new part number to see if it has been replaced, etc - looping
until it doesn't find a match. At that time I want the MfrGageLookup
procedure to lookup the info for the latest part number.
Everytime I try to run the procedure, I get the following error:
Server: Msg 201, Level 16, State 4, Procedure procMfrGageLookup, Line 0
Procedure 'procMfrGageLookup' expects parameter '@GageDesc', which was not
supplied.
If run from query analyzer on it's own, procMfrGageLookup works great
without any errors.
Can someone tell me what I'm doing wrong?
Below are the procedures:
-----
procMfrGageLookup
DECLARE
@MfrGageLookup nvarchar(32),
@GageDesc nvarchar(64) OUTPUT,
@VendName nvarchar(30)OUTPUT,
@GagePrice money OUTPUT
AS
(SELECT tblMfrGages.MfrGageModel, tblVendorHeader.VendName,
tblMfrGages.MfrGageDesc, tblMfrGages.MfrGagePrice
FROM tblMfrGages
INNER JOIN tblVenderHeader ON tblMFrGages.MfrName = tblVendorHeader.VendID
WHERE (tblMfrGages.MfrGageModel = @MfrGageLookup))
-----
procMfrReplacedGageLookup
@MfrGageLookup nvarchar(32)
@NewModel nvarchar(32) OUTPUT
AS
(SELECT tblMfrReplacedGages.MfrOldGageModel,
tblMfrReplacedGages.MfrNewGageModel
FROM tblMfrReplacedGages
WHERE (tblMfrReplacedGages.MfrOldGageModel = @MfrGageLookup))
--A replacement WAS found
IF @NewModel IS NOT NULL
BEGIN
SET @MfrGageLookup = @NewModel
SET @NewModel = NULL
EXEC procMfrReplacedGageLookup
END
--A replacement is NOT found
ELSE
EXEC procMfrReplacedGageLookup @MfrGageLookup
Thank you in advance for your assistance.
Cevin