January 1, 2009 at 3:36 pm
Hi all,
Hope someone could help me out... i created a job in SQL to look at a text file and import it to a specific table. I want to automate this by using a batch file. It checks if the file exists, then execute the job.
i know how to check the file if it exists by using the below command. but i don't know how to execute the job in sql :(.
IF EXIST textfile.txt "execute the job in sql".
Thanks in advance.
January 1, 2009 at 6:55 pm
Lookup "OSQL Utility" in Books Online.
The real key here is, why are you trying to do this from the command line... SQL Server can check to see if a file exists or not...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 2, 2009 at 7:00 am
Thanks Jeff,
I figured out how to do it in SQL job by using the "operating system command (CmdExec)"
Now i just need to know how to add another DTS package to this existing Job. 🙁
January 2, 2009 at 7:34 am
I got it. right click on DTS that you want to execute and click "schedule package" and hit ok.
go to jobs, locate the job that you just created then properties, go to steps tab, double click on the step and you will see the command to run it "DTSRun /!Z0x....."
copy the whole thing, go to the job that you want to add to... properties, steps tab, click new, name it whatever you want, for type choose "Operating System Command (CmdExec)", in Command box, right click and paste.
that is it.
thanks to everyone and hope it would help someone out.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply