Link to home
Start Free TrialLog in
Avatar of deanmachine333
deanmachine333Flag for United Kingdom of Great Britain and Northern Ireland

asked on

CTE - Hierarchy sql server 2008 r2

Hello ,

I have a software that has a sql database that allows users to create folders and permisions to those folders and also subfolders. It has the following columns to see whats link to what  -

ID , NODETYPE , NODENUM , HPARENT_NODE_ID , TITLE

now top level folders has HPARENT_NODE_ID = 1 the subfolders for this folder has the ID of this top level folder (15631) in the HPARENT_NODE_ID but these folders can also have sub folders which in turn have the second level ID (15634) in the HPARENT_NODE_ID

i have been trying to use CTE but cant quiet get it, can someone please advise as i want to be able to display all sub folders and files when selecting one Top level folder?

thanks

 User generated image
ASKER CERTIFIED SOLUTION
Avatar of jogos
jogos
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial