Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recursive user defined function

Status
Not open for further replies.

enas

IS-IT--Management
Joined
Dec 3, 2001
Messages
1
Location
EG
i'm trying to write function that deals with a recursive table called "centers" with coloms "center_id PK,Parent_id FK to center_id,center" as i want to get the parent and all his childs but i have problems this is my function CREATE FUNCTION Full_Center_Path(@IN_CAT_ID int) RETURNS nvarchar AS BEGIN DECLARE @OUT_PATH nvarchar DECLARE @center nVARCHAR DECLARE @center_ID int

EXEC SQL SELECT max(Centers.center),MAX(Centers.PARENT_ID) into :center,:center_ID FROM centers WHERE centers.center_ID=@IN_CAT_ID;

iF IN_CAT_ID <>0 set @OUT_PATH=Full_Center_Path(Center_ID) + center+'/'

RETURN (@OUT_PATH); END can any one help me in this








 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top