I need help creating a tree structure with a stored procedure using Cursor (Or perhaps another solution) I will use it to display different newsgroups messages like this in this discussiongroup.
The problem I have is to get them in the right order. I`m using a table with this fields:

DocumentID Int -> Key for the document
Parent Int -> Which DocumentID the message is replyed from. Value set to 0 if it`s the original message.
Top Int -> Points to the original msg. The original msg have Top=DocumentID
Level SmallInt -> How many steps it have been answered
Titel VarChar
Name VarChar
EMail VarChar
Message Text
...

Perhaps any other solution building the table(?)

tnx!
/Fredrik