Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS Package:Calling the DOS command 2

Status
Not open for further replies.

Wrinn

MIS
Apr 30, 2001
18
0
0
HK
Dear,
I've created one batch probram(contains set of dos commands). Is it possible to call this progrm from the DTS package?
Does anyone know how to do it? please let me know.
Thnx in advance,
 
You can use the Execute Process Task to run a batch file.
 
Hi,
You can use following extended stored procedure to run your dos commands

EXEC master..xp_cmdshell "myBatFile.BAT"

You should give full path if the batch file does not exist in defined path. As follows :

EXEC master..xp_cmdshell "c:\myDirectory\myBatFile.BAT"


Hope this will solve your problem.


 
Thank you so much.
Anyway, could u please give me some samples?

thnx again,
 
Hi,
I had followed the following steps and it works. You can try the same.

1) Create a test.bat file in c:\temp directory as follows.
@echo off
copy test.bat test1.bat

2) now at isql prompt write the following command and execute.
exec master..xpcmdshell "c:\temp\test.bat"

It will run the batch file and you will find a new file test1.bat in your c:\temp directory.


NOTE: Please be sure that you had created the test.bat file on the machine where sql server is running. Else if you want to create it on any other machine then follow the following steps.

Let us say your machine is 'myMachine' and it have a share name called temp which points to c:\temp
then,

1) Create a test.bat file on <myMachine> in c:\temp directory as follows.
@echo off
copy test.bat test1.bat

2) now at isql prompt write the following command and execute.
exec master..xpcmdshell &quot;\\myMachine\temp\test.bat&quot;


I hope this will help you in right direction.
 
thnx>>> :)
your advices are very useful
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top