Hello, I have a table Document where the versioning of each document is managed in a linked list format,
My requirement is to update the OriginatingID(same as the initial version DocumentID) of the first version to all its higher versions by a simple UPDATE statement with out giving much hit to performance as there are millions of records present in the table. I have a function fnGetHigherVersionIDs that returns me a table with all the higher version documentID's for a given initial versionID. The function logic is as follows.
Thanks for all your help in advance, Su.
Something like this should do the trick (recursive CTE to build a document family tree and then update the base table using this data):
answered Sep 10 '10 at 07:33 AM