Friday, March 23, 2012

Is it possible to execute DTS in SP?

Hi, i have a DTS then generate a CSV file, is it possible to execute the DTS
within a stored procedure?
Moreover, is it possible to dynamic change the current database in SQL Query
Analyzer by execute a Transact-SQL? As i know,
Use DB1 <== this command can change the current database
but is it possible to do the following:
declare @.dbName as char(255)
set @.dbName = 'DB2'
use @.dbName <== currently, this is not valid
Many thanks
MartinIndirectly yes,
You can execute DTS from a console window meaning it's command based. Now
SQL also have xp_cmdshell to execute commands in console.
So if you combine xp_cmdshell and tell it to execute dtsrun you should get
it working.
Have a look at the dtsrun, and xp_cmdshell in books online(sql help)
Hope it's a pointer in the right direction.
"Atenza" wrote:

> Hi, i have a DTS then generate a CSV file, is it possible to execute the D
TS
> within a stored procedure?
> Moreover, is it possible to dynamic change the current database in SQL Que
ry
> Analyzer by execute a Transact-SQL? As i know,
> Use DB1 <== this command can change the current database
> but is it possible to do the following:
> declare @.dbName as char(255)
> set @.dbName = 'DB2'
> use @.dbName <== currently, this is not valid
>
> Many thanks
> Martin
>
>|||> is it possible to execute the DTS
> within a stored procedure?
http://www.sqldts.com/default.aspx?210

> is it possible to dynamic change the current database in SQL Query
> Analyzer by execute a Transact-SQL?
It's easier to do this in DTS with a parameterized SQL task or Dynamic
Properties task. In Transact SQL you would have to use Dynamic SQL (not
recommended) and wrap all your code in an EXEC statatement.
David Portas
SQL Server MVP
--|||Thanks!!
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:A287DCD5-FC0C-48E6-8C6F-0A362941D6AD@.microsoft.com...
> http://www.sqldts.com/default.aspx?210
>
> It's easier to do this in DTS with a parameterized SQL task or Dynamic
> Properties task. In Transact SQL you would have to use Dynamic SQL (not
> recommended) and wrap all your code in an EXEC statatement.
> --
> David Portas
> SQL Server MVP
> --
>|||Thanks!!
"Mal .mullerjannie@.hotmail.com>" <<removethis> wrote in message
news:469E6F3C-B4A6-41B0-A041-1F43E6142197@.microsoft.com...
> Indirectly yes,
> You can execute DTS from a console window meaning it's command based. Now
> SQL also have xp_cmdshell to execute commands in console.
> So if you combine xp_cmdshell and tell it to execute dtsrun you should get
> it working.
> Have a look at the dtsrun, and xp_cmdshell in books online(sql help)
> Hope it's a pointer in the right direction.
> "Atenza" wrote:
>
DTS
Query

No comments:

Post a Comment