|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
sql server error EXEC -- OUTPUT
I have a c# app. This is a piece of code out of a stored proc. it is erroring: Procedure or function getTopParentDealerFromChildDealer has too many arguments
OR @dealerID is not a parameter for procedure getTopParentDealerFromChildDealer.(if I put ",@dealerID=@parentID) I have tried all combinations "@dealerID",@dealerID=@parentID" etc. BEGIN --get the top parent dealerID DECLARE @parentID INT SET @parentID = 0 EXEC getTopParentDealerFromChildDealer @dealerID, @parentID OUTPUT IF (@parentID>0) BEGIN ------------------------------------------------------ here is the getTopParentDealerFromChildDealer as called ------------------------------------------------------ ALTER PROCEDURE getTopParentDealerFromChildDealer @childDealerID INT AS SET NOCOUNT ON DECLARE @dealerID INT DECLARE @parentID INT SET @dealerID = 0 SELECT @dealerID = dealerParentID from dealerRelations where dealerChildID = @childDealerID WHILE @dealerID <> 0 BEGIN declare @temp INT set @temp = @dealerID IF (SELECT count(dealerParentID) FROM dealerRelations WHERE dealerChildID = @temp)>=1 BEGIN SELECT @dealerID = dealerParentID FROM dealerRelations where dealerChildID = @temp END ELSE BEGIN SET @dealerID=0 set @parentID = @temp END END if (@parentID IS NULL) BEGIN set @parentID = 0 --set @parentID = @dealerID END return @parentID I don't usually use stored procedures but the job I have taken over previously used them. Any help would be much appreciated. Thanks |
|
#2
|
|||
|
|||
|
Code:
ALTER PROCEDURE getTopParentDealerFromChildDealer @childDealerID INT, @parentID INT OUTPUT AS SET NOCOUNT ON DECLARE @dealerID INT <rest of code> |
|
#3
|
|||
|
|||
|
SQL server does not agree with that syntax(parentID already declared in procedure) but it could be the fn call. What is the correct syntax at the function call.
|
|
#4
|
|||
|
|||
|
Fixed the syntax and it worked thanks but had to create another almost identical proc to handle the single parameter call. Why would they do it? Why?
Thanks |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > sql server error EXEC -- OUTPUT |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|