Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

can i create dynamic execute SQL task ?

 
   Database Forums (Home) -> DTS RSS
Next:  Problem installing SP2  
Author Message
XJ

External


Since: May 29, 2007
Posts: 6



(Msg. 1) Posted: Fri Dec 28, 2007 2:03 am
Post subject: can i create dynamic execute SQL task ?
Archived from groups: microsoft>public>sqlserver>dts (more info?)

Hi All,
i have a existing DTS package, however the execute SQL task
keep changing, instead, i will create one table to store those execute
SP name and using query to run for it. do you think the idea is
possible?

 >> Stay informed about: can i create dynamic execute SQL task ? 
Back to top
Login to vote
nite_eagle

External


Since: Aug 14, 2006
Posts: 9



(Msg. 2) Posted: Fri Dec 28, 2007 6:05 am
Post subject: Re: can i create dynamic execute SQL task ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Dec 28, 4:03 am, XJ wrote:
> Hi All,
> i have a existing DTS package, however the execute SQL task
> keep changing, instead, i will create one table to store those execute
> SP name and using query to run for it. do you think the idea is
> possible?

Yes, use a dynamic properties task to set the SQLStatement property of
the Execute SQL Task. The dynamic properties task can be configured to
use a query by choosing Query in the Source drop down list.

Nice step by step how to here http://www.sqlservercentral.com/articles/DTS/dynamicproperties/1912/

Norman
DTS Package Search
http://www.dtspackagesearch.com/

 >> Stay informed about: can i create dynamic execute SQL task ? 
Back to top
Login to vote
Russell Fields

External


Since: Feb 21, 2007
Posts: 457



(Msg. 3) Posted: Fri Dec 28, 2007 9:18 am
Post subject: Re: can i create dynamic execute SQL task ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

XJ,

The idea is possible. Your code will be implemented as dynamic-SQL when you
do this, with the attendant issues of rights, code safety, and so forth.
So, you should review the standard text by Erland Sommarskog:
http://www.sommarskog.se/dynamic_sql.html

Since your code will actually be stored in a table, then you will probably
wind up doing something like this:

Declare @CodeToRun NVARCHAR(1000)

SELECT @CodeToRun = CodeColumn
FROM MyCodeTable
WHERE Key = 1

EXEC sp_executesql @CodeToRun

RLF



"XJ" wrote in message

> Hi All,
> i have a existing DTS package, however the execute SQL task
> keep changing, instead, i will create one table to store those execute
> SP name and using query to run for it. do you think the idea is
> possible?
>
 >> Stay informed about: can i create dynamic execute SQL task ? 
Back to top
Login to vote
XJ

External


Since: May 29, 2007
Posts: 6



(Msg. 4) Posted: Fri Dec 28, 2007 7:36 pm
Post subject: Re: can i create dynamic execute SQL task ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Dec 28, 10:05 pm, wrote:
> On Dec 28, 4:03 am, XJ wrote:
>
> > Hi All,
> >          i have a existingDTSpackage, however the execute SQLtask
> > keep changing, instead, i willcreateone table to store those execute
> > SP name and using query to run for it. do you think the idea is
> > possible?
>
> Yes, use adynamicpropertiestaskto set the SQLStatement property of
> the Execute SQLTask. Thedynamicpropertiestaskcan be configured to
> use a query by choosing Query in the Source drop down list.
>
> Nice step by step how to herehttp://www.sqlservercentral.com/articles/DTS/dynamicproperties/1912/
>
> NormanDTSPackage Searchhttp://www.dtspackagesearch.com/

Hi, thanks for ur reply, do u think is possible to create some dynamic
"execute SQL task" from T-SQL? base on different kind of the scenarios
we may also add some task quantity dynamically.
 >> Stay informed about: can i create dynamic execute SQL task ? 
Back to top
Login to vote
XJ

External


Since: May 29, 2007
Posts: 6



(Msg. 5) Posted: Fri Dec 28, 2007 7:37 pm
Post subject: Re: can i create dynamic execute SQL task ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Dec 28, 10:18 pm, "Russell Fields"
wrote:
> XJ,
>
> The idea is possible.  Your code will be implemented asdynamic-SQL when you
> do this, with the attendant issues of rights, code safety, and so forth.
> So, you should review the standard text by Erland Sommarskog:http://www.sommarskog.se/dynamic_sql.html
>
> Since your code will actually be stored in a table, then you will probably
> wind up doing something like this:
>
> Declare @CodeToRun NVARCHAR(1000)
>
> SELECT @CodeToRun = CodeColumn
>   FROM MyCodeTable
>   WHERE Key = 1
>
> EXEC sp_executesql @CodeToRun
>
> RLF
>
> "XJ" wrote in message
>
>
>
>
>
> > Hi All,
> >         i have a existingDTSpackage, however the execute SQLtask
> > keep changing, instead, i willcreateone table to store those execute
> > SP name and using query to run for it. do you think the idea is
> > possible?- Hide quoted text -
>
> - Show quoted text -

yes, this is a good artitcle, however i still got a same question, is
possible to execute query at parallel time?
 >> Stay informed about: can i create dynamic execute SQL task ? 
Back to top
Login to vote
Russell Fields

External


Since: Feb 21, 2007
Posts: 457



(Msg. 6) Posted: Mon Dec 31, 2007 8:32 am
Post subject: Re: can i create dynamic execute SQL task ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> yes, this is a good artitcle, however i still got a same question, is
> possible to execute query at parallel time?

XJ, Sorry, but I don't understand your latest question. You did not
mention parallel time in your original post.

1) Yes, you can generate and execute dynamic SQL from a combination of table
values and other logic.

2) TSQL executes synchronously with the calling source.. Any parallel
threads from DTS come from the design of the package, not of the dynamic SQL
query. http://technet.microsoft.com/en-us/library/aa933475(sql.80).aspx

RLF
 >> Stay informed about: can i create dynamic execute SQL task ? 
Back to top
Login to vote
Display posts from previous:   
   Database Forums (Home) -> DTS All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]