Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I execute a DOS command file from SSIS?

Posted on 2010-08-31
5
Medium Priority
?
1,083 Views
Last Modified: 2013-11-10
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
Comment
Question by:jfvassar
5 Comments
 
LVL 16

Accepted Solution

by:
carsRST earned 200 total points
ID: 33567899
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
 
LVL 16

Expert Comment

by:vdr1620
ID: 33567904
you can use a Execute Process task in Control flow and then select the path of your Batch file
0
 

Expert Comment

by:viralbhatt
ID: 33567953
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
 
LVL 16

Expert Comment

by:vdr1620
ID: 33568014
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
 

Author Closing Comment

by:jfvassar
ID: 33665661
set shell=nothing is required at the end of the task  :-)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question