Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a scalar function in a stored procedure

I am wacking my head over the problem with this code.

DECLARE @root hierarchyid DECLARE @lastchild hierarchyid SELECT @root = NodeHierarchyID FROM NodeHierarchy WHERE ID = 1 SET @lastchild = getlastchild(@root) 

It says it does not recognize getlastchild function. What am I doing wrong here?

like image 936
Luke101 Avatar asked Apr 20 '10 16:04

Luke101


People also ask

Can we call a function in stored procedure?

We cannot call store procedure within a function. However, we can call a function within a store procedure.


1 Answers

try including the schema id, as in

@lastchild = dbo.getlastchild(@root) 
like image 62
SeaDrive Avatar answered Oct 05 '22 11:10

SeaDrive