Solved

How can I execute a DOS command file from SSIS?

Posted on 2010-08-31
5
968 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 50 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

726 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