Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a recursive CTE-query like this:
SQL
;With cte As
(Select e.entryID, e.bOpen, e.nextEntryID, e.entryID As OriginalentryID
From entries e
Where e.bOpen = 1 And e.nextEntryID Is Not Null
Union All
Select e.entryID, e.bOpen, e.nextEntryID, c.OriginalentryID
From cte c
Inner Join entries e On e.entryID = c.nextEntryID)
Select c.entryID, c.OriginalentryID
From cte c
Where bOpen = 0;


Would there be any way to realise this without CTE (i.e. for SQL Server 2000)?
Any hints/ideas are appreciated.
Posted
Comments
Maciej Los 24-Feb-14 16:09pm    
Post entire cte-query (if you want our help) and shortly describe your issue. Provide sample data and expected output.
coded007 6-Aug-14 1:56am    
for SQL 2000 better way is write to cursor

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900