Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1160
  • Last Modified:

How can I execute a DOS command file from SSIS?

I thought the step would just be Type = Operating System (CmdExec) and then reference the path and name of the .bat file I want SQL Server to execute.  
0
jfvassar
Asked:
jfvassar
1 Solution
 
carsRSTCommented:
Add an ActiveX script task and try something like this.

dim shell
set shell=createobject("wscript.shell")
shell.run "myBatFile.bat"

Also-you might get better responses if you bump up the points.  :)
0
 
vdr1620Commented:
you can use a Execute Process task in Control flow and then select the path of your Batch file
0
 
viralbhattCommented:
Create a batch file that looks something like this (SQLTest.bat);


SET SQLCMD=sqlcmd -S ServerName -d dbaseName -U sa -P Password -o 'c:\logfile..log'
%SQLCMD% -i 'c:\file1.sql'
%SQLCMD% -i 'c:\file2.sql'
%SQLCMD% -i 'c:\file3.sql'

Then execute the batch file
(Line 1 establishes a connection, then lines 2 to 4 are the files to execute)
0
 
vdr1620Commented:
ActiveX script task is being deprecated in feature versions and is only available to support previous DTS packages..i would suggest you to avoid using ActiveX script Task
0
 
jfvassarAuthor Commented:
set shell=nothing is required at the end of the task  :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now