Заказ структуры связанного списка в запросе SQL или LINQ?

I have a database that essentially looks like this:

id uniqueidentifier NOT NULL
data nvarchar
nextid uniqueidentifier NULL

This is a Linked List, as each nextid links to an id in that table, except for the last one, here nextid is NULL. I do know the id of the first node.

I want to SELECT them all in the correct order, given a start id.

Is there a way this can be done in T-SQL (Edit: SQL 2008) or LINQ?

I know I can write code to do it manually in C#, just wondering if I can already query in that order?

5
задан Michael Stum 6 December 2010 в 22:34
поделиться