XSolvo
Current user:   guest    Change     Preferences 
   List directory   History   Similar   Print version 
XSolvo 
   About XSolvo 
Articles 
html2xml 
tradufix 
TVProgramGrabber 
download 
Philosophy 
gallery 

Articles > Transaction chunks

 
rw-rw-r--   stga   wheel

Transaction chunks

DECLARE @ROWS int
SET @ROWS = 0

UPDATE    #allLinks SET @ROWS=@ROWS+1,
        RowNum = IsNull(RowNum,0)+@Rows

CREATE UNIQUE INDEX RowNum_IX on #allLinks(RowNum)

DECLARE @FromRow INT
DECLARE @ROWCNT INT
SET @FromRow = 1
SET @ROWCNT = 1000

WHILE (@ROWCNT <> 0)
BEGIN
    PRINT convert(varchar,@FromRow) + ' - ' +convert(varchar,@FromRow+@RowCnt)
    WHERE RowNum BETWEEN @FromRow and @FromRow + @ROWCNT
    SET @ROWCNT = @@ROWCOUNT
    SET @FromRow = @FromRow + @ROWCNT + 1
END
DECLARE @from int, @to int, @rows int
SET LOCK_TIMEOUT 0
select @from = min(articleIdNo) from article

set @rows = 1
WHILE (@rows <> 0)
BEGIN
    set @to = @from + 10000
    UPDATE     Article
        Set tecDocArtNr = null,
        tecDocEinspNr = null,
        tecDocSyncFlag = 0
    WHERE    articleIdNo between @from and @to
    SET @rows = @@ROWCOUNT
    print @rows
    set @from = @to + 1
END

print @rows


Reference Transaction chunks
http://www.xsolvo.com/Articles/TransactionChunks


Prev. Regular Expressions in SQL Server   OPENQUERY Next