Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Location
    Montreal, Canada
    Posts
    151

    Unanswered: Endless looping job!!!!

    i have created a job that i have scheduled to run every 10 min everything is configured well since i have tested preety everything their is to be tested and found that it was my last step wich as a fetch in it so i imagine that this fetch is making it loop over and over again. the job goes trought all the steps and starts back at the first step and keep going like that till i disable it here is my fetch statement and if you have any clue any help would be widely apreciated.


    PS: i suspected it to be that fetch statement causing the havoc



    DECLARE
    @TransactionNb varchar(10),
    @EqId varchar(10)

    DECLARE TransactionNb_cursor CURSOR
    FOR
    SELECT TransactionNb, EqId
    FROM DetCom
    WHERE UpdCode = 'C'

    OPEN TransactionNb_cursor

    FETCH NEXT FROM TransactionNb_cursor
    INTO @TransactionNb, @EqId

    WHILE @@FETCH_STATUS <> -1
    BEGIN
    -- Vérifier s'il existe une transaction avec le UpdCode = 'C' dans EntCom
    IF (SELECT UpdCode
    FROM EntCom
    WHERE TransactionNb = @TransactionNb and EqId = @EqId) = 'C'
    BEGIN
    CONTINUE
    END
    ELSE
    BEGIN
    RAISERROR (50006, 10, 0, @TransactionNb, @EqId)
    END

    FETCH NEXT FROM TransactionNb_cursor
    INTO @TransactionNb, @EqId
    END

    CLOSE TransactionNb_cursor
    DEALLOCATE TransactionNb_cursor

  2. #2
    Join Date
    Jan 2004
    Posts
    7
    Change the loop terminator to WHILE @@FETCH_STATUS = 0
    not <> -1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •