How to execute a package SSIS 2008 - sql-server

Does anyone know how to trigger the execution of a SSIS 2008 package while running a DTS 2000 package?
Actually, my DTS 2000 has to be runned as it is and cannot be converted into a SSIS 2008.
SO is it possible to execute maybe a shell command (Dtutil , etc..) to run this SSIS 2008 package?
Thanks for feedbacks

There are two ways I can think of doing this.
Make the DTS execution a step in a SQL Agent job, and start that job by running the stored procedure sp_start_job
Run by executing xp_cmdshell:
EXEC xp_cmdshell 'dtexec /f "C:\Package.dtsx"'
Option two involves configuring xp_cmdshell to run. xp_cmdshell allows you to issue operating system commands directly to the Windows command shell via T-SQL code - something I'm not entirely comfortable with, so I would go for option 1.
Some helpful links:
sp_start_job
Execute SSIS Package using the Stored Procedure in T-SQL.
Executing all SSIS packages in a folder: three methods

Related

SQL Server to check for files in directory

I was wondering if it is possible for SQL Server to check a directory for files and run a stored procedure. I did some research and found this, but I am wondering if there is a way to do what I want WITHOUT SSIS.
EDIT: After reading my post, I realized I should have been more specific. Is there a way to AUTOMATICALLY or set SQL Server to check for files in a directory and run a stored procedure?
You can use xp_cmdshell to run file related commands. To get a directly listing:
exec xp_cmdshell 'dir *.csv';
You can also use bulk insert to load a file from disk into a table and take actions based on the loaded contents.
Normally you'd use the File Watcher Task with SSIS. But you can also use SQL Server Agent to schedule a task for periodic execution, schedule a task with Windows Task Scheduler, or configure a stored procedure to runs at startup with sp_procoption that pauses (using waitfor) between processing times.

Issue in concurrently running 2 instances of the same SSIS package in SQL Agent

I created a basic SSIS package in SQL Server 2012 for testing concurrency using SQL Server agent jobs. I want to be able to run copies of the same package as part of different jobs.
Package Design:
There is a variable in the package called ThreadID which represent the thread in which the package is running. This variable is included in the configuration XML file as below:
-
1
There is only one task in the package. It is a simple Exec SQL Task that passes ThreadID to a stored procedure and the stored procedure writes the ThreadID in a SQL Server table.
Result:
Everything works fine when I execute one copy of the package in VS IDE or SQL Server agent job. The issue shows itself when I run two instances of the same package package concurrently in 2 different SQL agent jobs. Each job has a copy of the package file and a configuration XML file. One XML file has ThreadID=1 and another one has ThreadID=2. What I see in the SQL Server table is ThreadID of the job that first started. The table contains all 1 when I start the first job and then the second job. It will be all 2 when I start the second job first.
Any idea why?
Thanks

Batch file to open excel works on sql server agent , but sql server job never completes and goes in a loop

I have a batch file to open a spreasheet and run the auto open macro. This work . Putting the batch file on a sql server agent job, again it works but the job never seems to end . Any ideas why ?
Code for batch file
call C:\Imports\Account.xlsb
exit
code for sql server agent
C:\Windows\System32\cmd.exe /c "C:\Imports\Test\OpenExcelFile.bat"
I'm not sure why you would need to run cmd.exe to run a batch file. You should only need to specify the file name name in quotes while using an "Operating system (CmdExec) job step. The step should use the following code:
"C:\Imports\Test\OpenExcelFile.bat"
If this doesn't work, then try running the batch file from the xp_cmdshell stored procedure. Here's the code you would need to execute:
EXEC master.dbo.xp_cmdshell 'C:\Imports\Test\OpenExcelFile.bat';
GO
This could be called by a Transact-SQL script (T-SQL) job step.
Are you calling this in a SSIS package? The post was tagged as SSIS, but you never mentioned in the post that you tried to call this from a SSIS package. If this is a SSIS package, then are you able to run the SSIS package successfully in BIDS? If you are running this from BIDS, then you shouldn't need to call the cmd.exe file. There is an Execute Process Control Flow task that you could use that does not require running a batch file from cmd.exe. If you are not using a SSIS package, then can you remove the SSIS tag?

What is the easiest way of executing a series of T-SQL scripts sequentially without the command prompt?

I am not allowed to use command prompt, unfortunately.
Currently I use SQL Server Management Studio, but I could switch to VS2010, if it was easier there.
Running a set of scripts in a specific order, especially when doen manually, is a bit tedious.
Thank you very much for any suggestions you might have.
You can edit and run SQL scripts in SSMS if this helps
You can use :r filename.sql command in the SQLCMD script command to execute a sql script
:r first.sql
:r second.sql
One method would be to create a job with no schedule, then you can run it manually.
Each step in the job could be one of your scripts.
The benefit of using a job would be that you could set up alerting and get an email if any step failed.

SQL Server Integration Services SSIS 2005 - How to Let Users Run the Package?

So I made a package in SSIS to read data in from a text file and load it into a database table.
What's the best way to set this up for non technical end users to run this when desired?
My boss was thinking to have a SP launch it, and then have a report made in reporting services launch the stored procedure. Surely there's a better way though!
ASP.NET is a good solution: http://www.codeproject.com/KB/aspnet/SSIS_DOTNET.aspx
You could also create a SQL Agent Job to run the package with an empty schedule. Then create a web front end to call EXEC msdb.dbo.sp_start_job N'Your SSIS Job Name';
It's not entirely straightforward, and comes with a number of health warnings, but it is possible to configure as SSRS report to use an SSIS package as a datasource - see http://msdn.microsoft.com/en-us/library/ms345250.aspx.
With this enabled, you could add an extra step to your SSIS package to output one (or more) report datasets to an SSRS report.
From the command prompt:
DTEXEC.EXE /F "C:\YOUR_PACKAGE.dtsx"
Full syntax here: http://msdn.microsoft.com/en-us/library/ms162810.aspx

Resources