dbTalk Databases Forums  

Global variable as the source DB in a transform data task

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Global variable as the source DB in a transform data task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Elizabeth
 
Posts: n/a

Default Global variable as the source DB in a transform data task - 09-11-2005 , 01:08 PM






Hi there,
I am new DTS developer so I hope my question will be clear.
I need to transform a table but the exact DB should be a dynamic variable.
That's why I thought to use a global variable.
The problem is that when I try to change the SQL to -

Select station_code from [?].Station

I get am error.

Probably this is not the right way to do it.

So what is the right way?

Many thanks,
--
Elizabeth

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Global variable as the source DB in a transform data task - 09-11-2005 , 01:48 PM






Elizabeth

I will presume you are using a DataPump task (Transform Data task).
This task has two connections associated with it.

1. The Source
2. The Destination


The syntax you are using would, if it worked, be asking for a
parameterized object owner not database. The simplest way to achieve
what I think you want is to have a very plain statement against the
Source connection of

SELECT <column list> FROM <owner>.<table>

The connection which you will be using will take care of the database
side of things. Now what you need to be able to do is to change the
DataSource property of the connection. For that you can use an Active
Script task before the DataPump task and do something like this

DTSGlobalVariables.Parent.Connections("Name of Connection").DataSource =
DTSGlobalVariables("Name of variable").Value


How do you intend to pass in the value for the global variable?


HTH

Allan




"Elizabeth" <Elizabeth (AT) discussions (DOT) microsoft.com> wrote


Quote:
Hi there,
I am new DTS developer so I hope my question will be clear.
I need to transform a table but the exact DB should be a dynamic
variable.
That's why I thought to use a global variable.
The problem is that when I try to change the SQL to -

Select station_code from [?].Station

I get am error.

Probably this is not the right way to do it.

So what is the right way?

Many thanks,
--
Elizabeth


Reply With Quote
  #3  
Old   
Elizabeth
 
Posts: n/a

Default Re: Global variable as the source DB in a transform data task - 09-11-2005 , 03:07 PM



Hi Allan,
Thank you for your quick responce.

Currently, I execute the package using the following code -

Dim MyPack As New dts.Package

MyPack.LoadFromStorageFile Fname, passwrd
MyPack.Execute

Is there any way using those functions to send the global variable?

Many thanks
--
Elizabeth


"Allan Mitchell" wrote:

Quote:
Elizabeth

I will presume you are using a DataPump task (Transform Data task).
This task has two connections associated with it.

1. The Source
2. The Destination


The syntax you are using would, if it worked, be asking for a
parameterized object owner not database. The simplest way to achieve
what I think you want is to have a very plain statement against the
Source connection of

SELECT <column list> FROM <owner>.<table

The connection which you will be using will take care of the database
side of things. Now what you need to be able to do is to change the
DataSource property of the connection. For that you can use an Active
Script task before the DataPump task and do something like this

DTSGlobalVariables.Parent.Connections("Name of Connection").DataSource =
DTSGlobalVariables("Name of variable").Value


How do you intend to pass in the value for the global variable?


HTH

Allan




"Elizabeth" <Elizabeth (AT) discussions (DOT) microsoft.com> wrote in message
news:E11AF2F6-1FFA-4BB3-AC38-028BFFC39A5E (AT) microsoft (DOT) com:

Hi there,
I am new DTS developer so I hope my question will be clear.
I need to transform a table but the exact DB should be a dynamic
variable.
That's why I thought to use a global variable.
The problem is that when I try to change the SQL to -

Select station_code from [?].Station

I get am error.

Probably this is not the right way to do it.

So what is the right way?

Many thanks,
--
Elizabeth



Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Global variable as the source DB in a transform data task - 09-11-2005 , 03:45 PM



Sure

If you are doing it like this then you do not need to use a Global
variable. Between the MyPack.LoadFromstorageFile and the MyPack.Execute
lines you can simly set the correct property on the connection in the
connections collection on the MyPack object.



Allan



"Elizabeth" <Elizabeth (AT) discussions (DOT) microsoft.com> wrote


Quote:
Hi Allan,
Thank you for your quick responce.

Currently, I execute the package using the following code -

Dim MyPack As New dts.Package

MyPack.LoadFromStorageFile Fname, passwrd
MyPack.Execute

Is there any way using those functions to send the global variable?

Many thanks
--
Elizabeth


"Allan Mitchell" wrote:


Elizabeth

I will presume you are using a DataPump task (Transform Data task).
This task has two connections associated with it.

1. The Source
2. The Destination


The syntax you are using would, if it worked, be asking for a
parameterized object owner not database. The simplest way to achieve
what I think you want is to have a very plain statement against the
Source connection of

SELECT <column list> FROM <owner>.<table

The connection which you will be using will take care of the database
side of things. Now what you need to be able to do is to change the
DataSource property of the connection. For that you can use an Active
Script task before the DataPump task and do something like this

DTSGlobalVariables.Parent.Connections("Name of Connection").DataSource
=
DTSGlobalVariables("Name of variable").Value


How do you intend to pass in the value for the global variable?


HTH

Allan




"Elizabeth" <Elizabeth (AT) discussions (DOT) microsoft.com> wrote in message
news:E11AF2F6-1FFA-4BB3-AC38-028BFFC39A5E (AT) microsoft (DOT) com:


Hi there,
I am new DTS developer so I hope my question will be clear.
I need to transform a table but the exact DB should be a dynamic
variable.
That's why I thought to use a global variable.
The problem is that when I try to change the SQL to -

Select station_code from [?].Station

I get am error.

Probably this is not the right way to do it.

So what is the right way?

Many thanks,
--
Elizabeth





Reply With Quote
  #5  
Old   
Elizabeth
 
Posts: n/a

Default Re: Global variable as the source DB in a transform data task - 09-11-2005 , 04:11 PM



Thank you - I will
--
Elizabeth


"Allan Mitchell" wrote:

Quote:
Sure

If you are doing it like this then you do not need to use a Global
variable. Between the MyPack.LoadFromstorageFile and the MyPack.Execute
lines you can simly set the correct property on the connection in the
connections collection on the MyPack object.



Allan



"Elizabeth" <Elizabeth (AT) discussions (DOT) microsoft.com> wrote in message
newsA01212B-33E0-49D3-B4B9-70319D24FB05 (AT) microsoft (DOT) com:

Hi Allan,
Thank you for your quick responce.

Currently, I execute the package using the following code -

Dim MyPack As New dts.Package

MyPack.LoadFromStorageFile Fname, passwrd
MyPack.Execute

Is there any way using those functions to send the global variable?

Many thanks
--
Elizabeth


"Allan Mitchell" wrote:


Elizabeth

I will presume you are using a DataPump task (Transform Data task).
This task has two connections associated with it.

1. The Source
2. The Destination


The syntax you are using would, if it worked, be asking for a
parameterized object owner not database. The simplest way to achieve
what I think you want is to have a very plain statement against the
Source connection of

SELECT <column list> FROM <owner>.<table

The connection which you will be using will take care of the database
side of things. Now what you need to be able to do is to change the
DataSource property of the connection. For that you can use an Active
Script task before the DataPump task and do something like this

DTSGlobalVariables.Parent.Connections("Name of Connection").DataSource
=
DTSGlobalVariables("Name of variable").Value


How do you intend to pass in the value for the global variable?


HTH

Allan




"Elizabeth" <Elizabeth (AT) discussions (DOT) microsoft.com> wrote in message
news:E11AF2F6-1FFA-4BB3-AC38-028BFFC39A5E (AT) microsoft (DOT) com:


Hi there,
I am new DTS developer so I hope my question will be clear.
I need to transform a table but the exact DB should be a dynamic
variable.
That's why I thought to use a global variable.
The problem is that when I try to change the SQL to -

Select station_code from [?].Station

I get am error.

Probably this is not the right way to do it.

So what is the right way?

Many thanks,
--
Elizabeth






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.