Solved

How can I execute a DOS command file from SSIS?

Posted on 2010-08-31
5
898 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
Comment Utility
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
Comment Utility
you can use a Execute Process task in Control flow and then select the path of your Batch file
0
 

Expert Comment

by:viralbhatt
Comment Utility
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
Comment Utility
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
Comment Utility
set shell=nothing is required at the end of the task  :-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Analysis of table use 7 26
Error when saving to sql table a '/' 5 17
SQL 2012 and SQL 2014 in memory database 11 28
Sql query 34 16
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…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now