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 |
dcarva
Posting Yak Master
140 Posts |
Posted - 2006-10-06 : 14:10:42
|
Hello,I have a table (simplified) as follows:Id Name ParentId0 Support -11 Level 3 02 Services 1So the full path looks like this based on parentid:Support\Level3\ServicesQuestion: what would the SELECT statement look like to return "Support\Level3\Services"? I can accomplish this using a cursor or temp table, but I want to avoid doing.Thanks for any help in advance,Danny |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-10-06 : 14:35:12
|
Avoid the cursor, use the temp table.You could do this by referencing the table three times, linked in a chain, but then you are hard-coding to always use three levels, and that is not good programming."Once you establish possibility, all that remains are desire and determination." |
 |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
|
dcarva
Posting Yak Master
140 Posts |
Posted - 2006-10-09 : 09:57:26
|
Thanks to all for your help. I ended up using something similar to what was posted, but I used table variables instead.ThanksDanny |
 |
|
|
|
|