Click here to Skip to main content
Sign Up to vote bad
good
See more: C#ASP.NETSQL
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:34
Edited 17 Dec '12 - 1:35

Comments
digimanus - 17 Dec '12 - 7:37
and the problem is?
ryanb31 - 17 Dec '12 - 8:19
What's the question?

1 solution

try this:
 
select @lcount= vainimarketing.dbo.Countnode(@lchild);
select @rcount= vainimarketing.dbo.Countnode(@Rchild);
  Permalink  
Comments
rajan1189 - 18 Dec '12 - 0:26
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 - 18 Dec '12 - 9:21
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
Your Filters
Interested
Ignored
     
0 OriginalGriff 296
1 Mohammed Hameed 183
2 Sergey Alexandrovich Kryukov 143
3 Santhosh G_ 108
4 Mayur_Panchal 98
0 Sergey Alexandrovich Kryukov 8,216
1 OriginalGriff 6,271
2 CPallini 3,528
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid