Hi,I've got a table (outlined below) that contains a list of URLs, the idea is that it allows us to keep out dated URLs in the database to redirect the search engines accordingly (i.e. to the new URL). The issue I have is that some of the URLs link to other URLs rather than the object themselves, what I would like to do in that instance is update them to point to the item instead of a URL, i.e. in the example below the URL '/' should point to '/another-link/' instead of '/some-link/'. Thanks to poor historic data in this table, the object link could be several links deep so I think I need some form of recursion to find the object id?We're using SQL Server 2005 so I thought some form of CTE might also work?TIATimCREATE TABLE #Url( Id int, Url varchar(100), ObjectTypeId int, ObjectId int)--ObjectTypeId Narative-- 1 : Url-- 2 : ObjectINSERT INTO #Url VALUES (1, '/', 1, 2)INSERT INTO #Url VALUES (2, '/some-link/', 1, 3)INSERT INTO #Url VALUES (3, '/another-link/', 2, 999)SELECT *FROM #UrlDROP TABLE #Url
----------------------------I've finally started blogging (all be it badly!)Check it out:http://blogs.thesitedoctor.co.uk/tim/