set @rowc= (SELECT COUNT(*) FROM Adaylogdb (nolock) a INNER JOIN workgroupjobsdb (nolock) w on w.JobID = a.JobRefNo WHERE a.PostingUser = '1002' and w.workGroupID = 57) --509763
print(@rowc) while (@rowc>0) begin UPDATE top (500) a SET a.PostingUser = '156161' FROM Adaylogdb (nolock) a INNER JOIN workgroupjobsdb (nolock) w on w.JobID = a.JobRefNo WHERE a.PostingUser = '1002' and w.workGroupID = 57 set @rowc = @rowc-500 end
VEYA
-- TOP 1000 lock durumuna gore ayarla DECLARE @i INT =1 WHILE(@i>0) BEGIN update AdayLogDB set CreationDate=Convert(datetime,left(postingdateN,8)+' '+SUBSTRING(Convert(nvarchar(12),PostingDateN),9,2)+':'+Right(PostingDateN,2)+':00',103),LastModifydate=getdate() WHERE Dummyid in (SELECT top 1000 Dummyid FROM AdayLogDB WITH(NOLOCK,INDEX(IX_LastModifyDate)) WHERE Dummyid >= 800000000 AND LastModifyDate IS NULL ) SET @i=@@ROWCOUNT END
-- KONTROL SORGUSU SELECT COUNT(1) FROM AdayLogDB WITH(NOLOCK,INDEX(IX_LastModifyDate)) WHERE Dummyid >= 800000000 --827629765 AND LastModifyDate IS NULL