Running dynamically SSIS packages(like DTS sp_OACreate)

Hi,
In DTS we use to run packages using sp_OACreate and sp_OAMethod. by passing in dynamically variables(file name or DTS name) how do we do equivalent of that in SSIS? Can stored procedured be used to run SSIS packages too?

Below is DTS version that uses sp_OACreate to run package:

Example:
--
-- Create the package
--
EXEC @hr = sp_OACreate 'DTS.Package', @oPKG OUT
IF @hr <> 0
BEGIN
PRINT '*** Create Package object failed'
EXEC sp_displayoaerrorinfo @oPKG, @hr
RETURN
END
-- Load the Package
-- DTSSQLServerStorageFlags
-- DTSSQLStgFlag_Default = 0 (Use Server authenticdation)
-- DTSSQLStgFlag_UseTrustedConnection = 256 (Use Windows Authentication)
Set @mycmd = 'LoadFromSQLServer("' + @Server + '", "", "", 256, , , , "' + @DTSPKG + '")'
EXEC @hr = sp_OAMethod @oPKG, @mycmd, NULL
IF @hr <> 0
BEGIN
PRINT '*** Load Package failed'
EXEC sp_displayoaerrorinfo @oPKG, @hr
RETURN
END


If yes how do I specify my packge name and in which method? to run them  
MayankSqlAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Reza RadConsultant, TrainerCommented:
use dtexec to run ssis packages
0
Reza RadConsultant, TrainerCommented:
0
Anthony PerkinsCommented:
>>In DTS we use to run packages using sp_OACreate and sp_OAMethod<<
This was a bad idea using DTS and totally unecessary, so please do not attempt doing the same using SSIS.  In fact, never use any of the sp_OA functions, they are a performance and security risk.
0
MayankSqlAuthor Commented:
How do I pass parameters at run time, like name of file location to a package. The reason sp_OA functions were used was because name of the file location was provided at run time.
Thanks for responses.
0
Anthony PerkinsCommented:
You can pass in parameters into an SSIS package or you can calculate them using expressions in the package itself.
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
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

From novice to tech pro — start learning today.