Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL
ALTER FUNCTION [vainimarketing].[dbo.Countnode](@node AS varchar(50))
Returns INT
AS
BEGIN
Declare @lnode Varchar(50)
Declare @rnode Varchar(50)
Declare @result INT
Select @lnode=LeftChild,@rnode=RightChild From Tree where ParentId=@node;
if(@lnode=0 AND @rnode=0)
begin
Set @result=1;
end
else
begin
set @result=1+(dbo.Countnode(@lnode)+dbo.Countnode(@rnode));
end
return @result;
END
 
stored procedure
set @lcount= vainimarketing.dbo.Countnode(@lchild);
set @rcount= vainimarketing.dbo.Countnode(@Rchild);
Posted 17-Dec-12 1:34am
Edited 17-Dec-12 1:35am
v2
Comments
digimanus at 17-Dec-12 7:37am
   
and the problem is?
ryanb31 at 17-Dec-12 8:19am
   
What's the question?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try this:
 
select @lcount= vainimarketing.dbo.Countnode(@lchild);
select @rcount= vainimarketing.dbo.Countnode(@Rchild);
  Permalink  
Comments
rajan1189 at 18-Dec-12 0:26am
   
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Countnode", or the name is ambiguous
 
please help me out from this,,thanks in advance..
sankasuresh at 18-Dec-12 9:21am
   
Hi,
 
can you run below code on SQL Mgmt studio and let me know what you get.
 
Declare @lnode Varchar(50)
Declare @rnode Varchar(50)
 
set @lnode = '30' -- assign valid id to see the results.
set @rnode = '30' -- assign valid id to see the results.
 
select @lcount= dbo.Countnode(@lchild);
select @rcount= dbo.Countnode(@Rchild);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 265
1 _Amy 235
2 Peter Leow 205
3 Andreas Gieriet 180
4 Dave Kreskowiak 130
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,412
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100