Mistři v programování na #hovnokod

SQL #4394

Produkcni kod. A pak se divi, ze je to pomale...

-- Delete User Log
DECLARE @intIdentityLog   as Int
DECLARE curTrans CURSOR
LOCAL FORWARD_ONLY
FOR SELECT
       UserLog_intIdentity
FROM tblUser_Log
WHERE UserLog_dtmDateRec BETWEEN @DateToPurge AND @dtmRetainAfter

OPEN   curTrans
FETCH NEXT FROM curTrans
INTO   @intIdentityLog
WHILE  @@FETCH_STATUS = 0
BEGIN
       SET @Processed = 'Y'
       IF @intTestMode<> 'Y'
       BEGIN
             DELETE FROM tblUser_Log
             WHERE CURRENT OF curTrans
       END
       ELSE
       BEGIN
             PRINT 'ULOGI : ' + CAST (@intIdentityLog AS varchar(10))
       END

       FETCH NEXT FROM curTrans INTO @intIdentityLog
END

CLOSE curTrans
DEALLOCATE curTrans

Lukáš Navrátil,