Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jameswoodmancy
Starting Member
13 Posts |
Posted - 2011-05-31 : 07:49:36
|
| Hi,I have a table that stores directory structure. Dir ID, ParentID, DirNameGiven the DirID I want to return all the directories up until the root directory where root has a parentID of NULL.I have been trying to use a CTE expression but without any success. Can anyone help? |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-05-31 : 07:54:01
|
| The MSDN page (http://msdn.microsoft.com/en-us/library/ms175972.aspx) has a sample very similar to what you are looking for, although it traverses from root to leaf - opposite of what you are looking for. Slight tweak to that query will work for you - if you can post your current query, it would be easy enough for someone on this forum to offer suggestions. |
 |
|
|
|
|
|