[quoted text, click to view] On Oct 30, 11:04 am, stainless <Mark.Wingfi...@gmail.com> wrote:
> This problem is taken from an earlier post of min ebut I felt it
> needed to be in its own post.
>
> Is it possible to use a Global parameter passed in via DTSRUN, to set
> up another Global parameter?
>
> I will try and expand on this.
>
> A DTS package is going to be reused for several different jobs. A
> global parameter identifying the job will be passed in via a DTSRUN
> parameter. This will set a global parameter, called AccountType on
> opening the package.
>
> On SQL reference tables, I am holding values, for each AccountType,
> that I want to retrieve and hold in other global variables for use
> throughout the package.
>
> e.g.
>
> ACCOUNT_TYPE is REDX
> On a reference table with ID 'REDX', there is a column Last_RUN_TIME
> that I need to pick up and place in global variable LastRunTime.
>
> I have used the Dynamic Properties Task and used queries in Add/Edit
> Assignment in the past to set up such global variables. However, this
> time, the query itself needs to use the passed in global parameter of
> AccountType. It appears to me that I cannot use the Parameters Lookup
> in Add/Edit Assignment. The use of '?' is only in the Execute SQL
> task. I thought I may be able to use the format below but apparently
> not:
>
> Select Last_RUN_TIME from reference_table where ID = ?
>
> Is it possible to use the value in AccountType at the start of the DTS
> run, in a query to create a second global variable?
>
> Cheers
Hi Stainless,
Sorry for the delayed response .. I don't actually have a copy of SQL
2000 to work on at the moment, but I'm pretty sure you can do this by
having 2 Dynamic Properties assignment tasks (the 1st configuring the
2nd). You might need an ActiveX task between the 2 to generate the
SQL string for the 2nd task, but I unfortunately I can't confirm this
lol.
Another possible solution (which might be easier if it works), is to
use an Execute SQL task (setting the query dynamically) instead of the
Dynamic Properties task to retrieve your LAST_RUN_TIME and return the
output to a variable. This is certainly possible in SQL2005, but as I
said, I'm a bit rusty on DTS2000 at the moment.
Maybe not the most useful reply, but hopefully gives you something to
work from :-/
Good luck!
J