|
HI: I want to update my table in chunck.. (if i have 10 rows i want to update 2/2) where did i do mistake in this script. Could you please guide me.
(comments are locked)
|
|
The problem is, that you are not distinguishing between already updated and not updated records. So the issue is in your Based on your example, you can put eg. a condition Anyway if you are working on SQL Server 2005 and above, you should use the See:
i dont want to update table at once coz there are millions of record so i want to update in chunk. how can i do that?
Apr 16 '12 at 06:46 PM
binodbabu
Exactly as you wrote it (or using the If you do not put the condition into the update query, your query will update in the circle only the first two records. Once you put the condition there, already updated records will not be updated again during next loop, but another records will be processed by subsequent loops.
Apr 16 '12 at 06:57 PM
Pavel Pawlowski
i want to run that script in production server.. if we update millions of record at once transaction log will be full so i want to update in batch ( in my example 2 records at a time) how can i do that.. Thanks in advance
Apr 16 '12 at 07:22 PM
binodbabu
We are writing in a circle.. Yous should do this exactly as hou have done it in your original question. Only you need to add a condition to distinguish between already modified and not modified records as you execute the update command in loop. If you do not include the condition, then it will not work as it will update only the first x records in each loop.
Apr 16 '12 at 07:49 PM
Pavel Pawlowski
oh ok got it thank you.
Apr 16 '12 at 07:59 PM
binodbabu
(comments are locked)
|

