views:

84

answers:

3

I am wacking y 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

+2  A: 

try including the schema id, as in @lastchild = dbo.getlastchild(@root).

SeaDrive
+1 you **CAN'T** call a user defined function in SQL Server 2008 without using the schema
KM
Thank you..It is working now
Luke101
A: 

Try

set @lastchild = dbo.getlastchild(@root)
Thomas
A: 

Use

set @lastchild = dbo.getlastchild(@root)

From CREATE FUNCTION

Scalar-valued functions may be invoked where scalar expressions are used, including computed columns and CHECK constraint definitions. When invoking scalar-valued functions, at minimum use the two-part name of the function.

astander

related questions