Check out this article: "Implementing the nested set model in ColdFusion" http://coldfusion.sys-con.com/read/42123.htm
hth, Phil >Hi there, > >I have the following category table which utilises a nested set model... > >CREATE TABLE [dbo].[categories] ( > [cat_id] [int] IDENTITY (1, 1) NOT NULL , > [dModified] [datetime] NULL , > [dCreated] [datetime] NULL , > [cat_parent_id] [int] NULL , > [cat_lft] [int] NULL , > [cat_rgt] [int] NULL , > [cat_image] [varchar] (255) COLLATE Latin1_General_CI_AS NULL , > [cat_sort_order] [int] NULL >) ON [PRIMARY] >GO > >What I wish to add to the table is a level column, eg. the top most >parent nodes would be level 1, their children level 2 and so on... > >I am a bit stumped as to how to create a query (I am using SQL Server >2000) that will determine what level a particular record is in the >hierarchy? > >Any help would be really appreciated. > >mike ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230829 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

