SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Job STep with multiple commands


Job STep with multiple commands

Author
Message
Janda Nel
Janda Nel
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 144
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.
wolfkillj
wolfkillj
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1462 Visits: 2582
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
Blog: SQLSouth
Twitter: @SQLSouth
durai nagarajan
durai nagarajan
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1609 Visits: 2775
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search