Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 execute package in sql

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2010-01-19 : 07:33:10
hello,
I have created a ssis package on my machine.
Question:
How do I execute a simple ssis package in sql?

This is what I am doing but I get an error:
declare @returncode int
declare @cmd varchar(1000)

declare @FileName varchar(100)
declare @FilePath varchar(1000)
declare @FullFilePath varchar(1000)

set @FileName = 'package.dtsx'
set @FilePath = 'C:\Work\\'
set @FullFilePath = @FilePath + @FileName

set @cmd = 'dtexec /f ' + @FullFilePath + '"'
print @cmd

exec @returncode = master..xp_cmdshell @cmd

Error:
The file name : ... specified in the connection was not valid.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2010-01-19 : 07:52:06
Why not just create a job and then use sp_start_job to run the package?

There is no easy way to run the package using T-SQL, there are difficult ways though.

Why do you want to run it using T-SQL?
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2010-01-19 : 08:17:19
Ok, I have created a job which successfully executes the package.
I will try this:
EXEC sp_start_job @job_name = 'Nightly Backup'
Thank you
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2010-01-19 : 08:25:59
Note that msdb should be used for this query to work.
Thanks
Go to Top of Page
   

- Advertisement -