Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
| Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #11 (permalink)  
Old June 12th, 2008, 03:09 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Quote:
quote:Originally posted by Old Pedant
 Anyway, he doesn't have a path, just the it/parentid relationship.

Ok, so his source table has a column called "Name". But it is clearly the "Path" of the nodes.
Quote:
quote:So if you could show him how to produce his desired output using SQL Server 2005 recursion, it would be appreciated, I'm sure!
I could, but there are plenty of resources out there that explain how to do it better than I can.

-Peter
compiledthoughts.com
  #12 (permalink)  
Old June 12th, 2008, 04:32 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Quibble quibble quibble...but I might as well live up to my screen name.

> Ok, so his source table has a column called "Name". But it is clearly the "Path" of the nodes.

Actually, it's not. To quote him (in part):

Raw data:
7 3 Root1_Child1_SubChild2

Desired output from SELECT:
7 3 0/Root1/Root1_Child1/Root1_Child1_SubChild2

And then full quote:
"i used strings for the Formatted path just so you can see a better visual, i will end up using the ID. for example instead of the formatted output of '0/Root2/Root2_Child1' i will need '0/2/5'"

So his name field is really just trash, insignificant in the example or code.

But never mind, the rest of your answer is sufficient.




Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP to query a SQL recursive tree chame Classic ASP Basics 4 April 10th, 2012 07:59 PM
Help with a recursive Query!!! dbayona SQL Server 2005 1 December 20th, 2007 07:40 AM
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
recursive query cathiec SQL Language 2 August 25th, 2006 05:58 AM
recursive transform output different in IE and FF seamus7 XSLT 2 January 20th, 2006 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.