• Hi,

    The above srcipt u gave is only for Fail,Success, Cancel.

    the code i used is like as follows

    _____________________________________________

    DECLARE Csr_CursorEmail CURSOR

    FOR SELECT top(5) ClientNo, Depot, Service, Sent FROM EmailFileSent WHERE SENT = '' order by clientno

    OPEN Csr_CursorEmail

    FETCH NEXT FROM Csr_CursorEmail into @ClientNo, @Depot, @Service, @Sent

    WHILE (@@FETCH_status =0)

    BEGIN

    EXEC msdb..sp_start_job @job_name = 'Job Name'

    FETCH NEXT FROM Csr_CursorEmail into @ClientNo, @Depot, @Service, @Sent

    END --CursorEmail

    close Csr_CursorEmail

    DEALLOCATE Csr_CursorEmail

    ___________________________________________________

    When i ran the cursor for sum records job is executing successfully, but for some records the job not executing

    and giving the error message as

    Msg 22022, Level 16, State 1, Line 0

    SQLServerAgent Error: Request to run job C5E96594-9876-42FE-9324-5F6DF8F5CC0B (from User Narayana) refused because the job already has a pending request from User Narayana.

    It seems Cursor is forcing to start the JOB while the previous record job is still executing.

    I think if i control job like = job have to wait until the previous record job is successfully executed

    How can i resolve this problem

    Please help.

    Narayana