MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old September 15th, 2004, 03:29 AM
gareth111 gareth111 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 45 gareth111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 21 sec
Reputation Power: 5
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

Reply With Quote
  #2  
Old September 15th, 2004, 03:38 AM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,766 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 6 h 24 m 8 sec
Reputation Power: 37
Code:
ALTER PROCEDURE getTopParentDealerFromChildDealer @childDealerID INT,
@parentID INT OUTPUT
AS

SET NOCOUNT ON
DECLARE @dealerID INT
<rest of code>

Reply With Quote
  #3  
Old September 15th, 2004, 06:54 PM
gareth111 gareth111 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 45 gareth111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 21 sec
Reputation Power: 5
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.

Reply With Quote
  #4  
Old September 15th, 2004, 08:20 PM
gareth111 gareth111 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 45 gareth111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 21 sec
Reputation Power: 5
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > sql server error EXEC -- OUTPUT


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway