Job STep with multiple commands

  • Good day

    I want to make a job step,but it must do various commands.The steps is as follows.

    1.Copy a file over to another file location

    2.Insert a records into a table in the database

    3. Run a dtsx import script

    4. Delete the original file which i have copied.

    i can achieve all this,but now i have 4 steps in my job.Is it possible to make 1 step,because i have to repeat this procedure for over 380 files.It would be nice to streamline the whole process.

    thanks for your help in advance.

  • Janda Nel (7/24/2013)


    Good day

    I want to make a job step,but it must do various commands.The steps is as follows.

    1.Copy a file over to another file location

    2.Insert a records into a table in the database

    3. Run a dtsx import script

    4. Delete the original file which i have copied.

    i can achieve all this,but now i have 4 steps in my job.Is it possible to make 1 step,because i have to repeat this procedure for over 380 files.It would be nice to streamline the whole process.

    thanks for your help in advance.

    The CmdExec job step will only execute a single line - you can include multiple commands in a single line if you separate them with "&&" (don't use the quotation marks).

    However, since you seem to have the ability to execute an SSIS package, it might be a lot easier to create a package with a For Each Loop container that would perform the same tasks on each file in a folder, then schedule a SQL Agent job to run the package.

    Jason Wolfkill

  • Janda Nel (7/24/2013)


    Good day

    I want to make a job step,but it must do various commands.The steps is as follows.

    1.Copy a file over to another file location

    2.Insert a records into a table in the database

    3. Run a dtsx import script

    4. Delete the original file which i have copied.

    i can achieve all this,but now i have 4 steps in my job.Is it possible to make 1 step,because i have to repeat this procedure for over 380 files.It would be nice to streamline the whole process.

    thanks for your help in advance.

    create step 5 and create query to identify any pending and pass it to success with go to step 1 and failure to close the job.

    i hope like the above user said using SSIS is easier.

    Regards
    Durai Nagarajan

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

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