|
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.
(comments are locked)
|
|
Something like this should do the trick (recursive CTE to build a document family tree and then update the base table using this data): Thanks a lot..it really worked great..Will update you how it worked with huge volume of data. Thanks, Su
Sep 10 '10 at 08:14 AM
sujafiza
If it is to be run on a large amount of data, you may want to batch the updates into a smaller subset of the data.
Sep 10 '10 at 08:41 AM
WilliamD
Oh yes..I was stopped by "Msg 530, Level 16, State 1, Line 2 The statement terminated. The maximum recursion 100 has been exhausted before statement completion."
Sep 10 '10 at 09:30 AM
sujafiza
A really weak answer to this is to supply the MAXRECURSION option and override the default of 100 with something a little higher (max is a squeeze above 32000).
Sep 12 '10 at 12:45 PM
WilliamD
setting MAXRECURSION 0 will give you infinite recursion
Sep 12 '10 at 08:00 PM
Scot Hauder
(comments are locked)
|

