Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 DTS Running Batch Program

Author  Topic 

arungulli
Starting Member

5 Posts

Posted - 2004-04-08 : 11:26:15

I am trying to run a batch program from the Win32 Process Task of the SQL Server.

Everything is working fine from the Enterprise Manager, except that the control is not returning back to the SQL Server after the tasks completion. It is opening a command window while running the batch file and this window remains open even after all the steps in the batch file are completed. When I manually close the window only then is the process showing a success.

I tried using commands such as EXIT, END at the end of the batch file.
Not sure what needs to be done. This is the first time I am working on a batch file. Any help?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-08 : 12:00:43
Could you post the batch file?

Tara
Go to Top of Page

arungulli
Starting Member

5 Posts

Posted - 2004-04-08 : 12:28:45
For example say the batch file contains the following 2 lines only

ftp.exe -i -s:parafile.txt > LogFile.txt
exit

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-08 : 12:30:23
Does the command prompt the user for anything? If it does, then that is your problem. You usually need to specify in the batch file not to prompt questions.

Tara
Go to Top of Page

arungulli
Starting Member

5 Posts

Posted - 2004-04-08 : 12:53:49

The batch file is exactly the same as posted it contains only those 2 lines. It does not prompt for any input from the user.

I am trying to FTP the files out of SQL Server to another machine using the first command and create a log file for the FTP process. Then exit the task. In the next task I am trying to go through the log file to check the status of success or failure.

Any other process that can be suggested for performing the above would be appreciated.

Would you be able to provide any sample batch file which can be run from DTS. Thank you for your help.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-08 : 12:57:59
Nigel has some code to put and get files using FTP:

http://www.nigelrivett.net/

The code uses T-SQL.

Tara
Go to Top of Page

arungulli
Starting Member

5 Posts

Posted - 2004-04-08 : 13:14:06

I am working in a sort of restricted environment. The DBA's do not grant privileges for using the extended stored procedure "master..xp_cmdshell" to the users.

Any other suggestions...
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-04-11 : 10:59:56
You can use the FTP command line utility from a SQL Server job. Create a new job and add a new job step. Change the type to "CmdExec", and enter the command line you'd use as if you were calling it from xp_cmdshell. You cannot pass parameters to a job step however, but if the command(s) are built correctly it won't need them.
Go to Top of Page
   

- Advertisement -