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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Threaded Discussion Forum

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2004-11-29 : 11:28:15
Hi there,

This article [url]http://www.sqlteam.com/Item.asp?ItemID=1353[/url] has a neat way of storing threads.

Lets say I pick the reply with a PostID of 13 from the output table shown in the article.

Is there a simple way to use this data storage method such that the result set only expands the message board far enough to show the post with id of 13?

So the returned items would be..

FirstPost
-First Reply
--First Sub Reply
--Reply to #10
---Reply to #13 <--selected post
--Reply to #10
-Second Reply
-Reply to #1
Top Level
Top Level

So you see, its only expanded the threads enough to show the path down to the selected post.

The only other way I can think of is to iterate from the selected item upwards gathering all children as one goes.

Cheers,

XF.

   

- Advertisement -