JOb fails if there is no data to load to a table from a query

  • hi,

    i created several pacakges which runs sql and load dat to a table. and all the packages are in the different steps of a job. If any of the step fails the job fails. I know you can set the job to "run if failure" and "go to next step" but this is different case.

    My dba has to run job manually if there is no data. Is there a way to do it?

  • komal145 (10/20/2016)


    hi,

    i created several pacakges which runs sql and load dat to a table. and all the packages are in the different steps of a job. If any of the step fails the job fails. I know you can set the job to "run if failure" and "go to next step" but this is different case.

    My dba has to run job manually if there is no data. Is there a way to do it?

    How does a zero-row INSERT cause a failure?

    CREATE TABLE #x (Col1 VARCHAR(50));

    INSERT #x

    (Col1)

    SELECT 'Nonsense'

    WHERE 1 = 2;

    No failure.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • komal145 (10/20/2016)


    ...My dba has to run job manually if there is no data. Is there a way to do it?

    Do you mean the DBA must (re-)start the job if there were no files/data to load (e.g. source)? Or does he need to (re-)run the job when no data was loaded in the database tables (e.g. destination)?

    If a re-run is required because missing source data: I suggest to build checks into the package to check the source before proceding. Or build better error-handling in the package to prevent an error if no data is processed.

    If a re-run is required becuase of missing destination data: I suggest to build an extra job and schedule it to run after the job with the packages has finished. In this new job you check the results in the destination and re-start the job with the packages if there is no data.

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply