Use batch file to execute SQL Server 2008 SSIS Package

Hi all.

When we had SQL Server 2000 we used to be able to run DTS packages remotely from end user computers via a batch file.

We would run dtsrunui and choose the DTS package and copy the command line script, below is an example:

DTSRun /S "myServer" /N "Import Pricing" /G "{E7DC6B4A-9DB4-473D-9292-F1C63612E47C}" /W "0" /E 

Open in new window


And again, we would put the batch file on the end user computers and they would double click it whenever they needed to run the DTS package.

I tried using DTEXEUI, but it says I need Integration Services installed, which I cannot install on my computer. And the end users who will run the batch file that will then run the SSIS package won't have Integration Services installed on their computer either.

How can we do this with SQL Server 2008 and the SSIS packages?

Thank you in advance.
printmediaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dsackerContract ERP Admin/ConsultantCommented:
You can create a SQL Agent job to execute the package.

From a Command Line, you can then run SQLCMD to execute the job (which executes the SSIS package).

SQLCMD -S YourServer -E -i MySqlCommands.sql -v job=MyJobName
The -i parameter specifies an input file.
The -v parameter says you're about to pass a variable, in case case, named "job".

Your MySqlCommands.sql file can then contain something like the following:

DECLARE @Name   varchar(30)

IF SUBSTRING('$(job)', 3, 3) <> 'job'   -- ensures we passed this from SQLCMD -v
    SET @Name = '$(job)'

IF @Name IS NULL
    PRINT 'Nothing started'
ELSE
IF NOT EXISTS (SELECT 1 FROM msdb.dbo.sysjobs WHERE name = @Name)
    PRINT 'Job ' + @Name + ' does not exist on ' + @@SERVERNAME
ELSE
IF NOT EXISTS (SELECT 1 FROM msdb.dbo.sysjobs WHERE name = @Name AND enabled = 1)
    PRINT 'Job ' + @Name + ' is not enabled on ' + @@SERVERNAME
ELSE
    EXEC msdb.dbo.sp_start_job @Name

Open in new window

Now you can run this from a command line or from a Windows task schedule.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dsackerContract ERP Admin/ConsultantCommented:
Note: I made a few clean-up changes to the above code. Hope this helps.
0
printmediaAuthor Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

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.