Home > Ask the SQL Server Experts > Adam Machanic - SQL Server 2005 Questions & Answers > Modifying a query to show navigation path
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

Modifying a query to show navigation path

Adam Machanic EXPERT RESPONSE FROM: Adam Machanic

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Expert advice on database development
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 27 June 2006
I viewed your article on the Common Table Expression that will recursively query itself. How can I modify this query to show the navigation path down the tree to each node returned in the result set, in a different format? For example, if the data is:

ID ParentId
A null
B A
C A
D B
E C

I want the result from your query to be:
ID Level Path
A 1 A
B 2 A.B
C 2 A.C
D 3 A.B.D
E 3 A.B.C



Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Adam Machanic - SQL Server 2005
Stored procedure concurrency problems in SQL Server 2005
SQL vs. T-SQL
Database Snapshots: Creating read-only copies of a database
Upgrading SQL Servers
Determining number of servers needed for large member site
SQL Server 2005 Enterprise Edition vs. Standard Edition
Encryption failures when upgrading to SQL Server 2005
Upgrading to SQL Server 2005 while maintaining .adp access
Viewing SQL Server 2005 data via Windows Forms
SQL Server 2005 upgrade issues

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SQL Solutions - SQL Database Design
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts