dbTalk Databases Forums  

help assigning value to global variable

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


Discuss help assigning value to global variable in the microsoft.public.sqlserver.dts forum.



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

Default help assigning value to global variable - 06-13-2005 , 11:26 AM






Hi,
I have a dts package that reads a text file and enters the data in a table.
There is a global variable which I have to pass the value when
executing the package. Instead of passing a value I want the package to do
everything. All I have to do is ececute the package.
I created an sql task that will get a value form a table and then assign it
to the global variable but, how do I assign it to the globalvariable so that
the next tasg can pickup the
value form the global variable?

The order I have i is

1. SQL task object gets value form table and assign to global variable.
<-------here I need help!
2. gets value form global variable and performs file import.

Thanks

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

Default Re: help assigning value to global variable - 06-13-2005 , 01:13 PM






Text files will not support variables like this so you will need to import
to a temp table first

As for reading a value from a table and inserting into a GV have a look here

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277,7)


You want pages 7 and 8.

Whilst we use input parameters here you want an aoutput parameter of the row
value so it may look like this your statement

SELECT SUM(column) as Val FROM TABLE

Make sense?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


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

Quote:
Hi,
I have a dts package that reads a text file and enters the data in a
table.
There is a global variable which I have to pass the value when
executing the package. Instead of passing a value I want the package to do
everything. All I have to do is ececute the package.
I created an sql task that will get a value form a table and then assign
it
to the global variable but, how do I assign it to the globalvariable so
that
the next tasg can pickup the
value form the global variable?

The order I have i is

1. SQL task object gets value form table and assign to global variable.
-------here I need help!
2. gets value form global variable and performs file import.

Thanks



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

Default Re: help assigning value to global variable - 06-13-2005 , 03:21 PM



Hi,
I need to assign the result from my query to the global variable. example
(sql task in the package)

select id from table where name = 'test'

I then need to then pass that value in id to the global variable so the
second object in my dts would then pick up that value and continue.

"Allan Mitchell" wrote:

Quote:
Text files will not support variables like this so you will need to import
to a temp table first

As for reading a value from a table and inserting into a GV have a look here

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277,7)


You want pages 7 and 8.

Whilst we use input parameters here you want an aoutput parameter of the row
value so it may look like this your statement

SELECT SUM(column) as Val FROM TABLE

Make sense?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Chris" <Chris (AT) discussions (DOT) microsoft.com> wrote in message
news:E43F7248-D630-4980-8EC2-E687152F91BA (AT) microsoft (DOT) com...
Hi,
I have a dts package that reads a text file and enters the data in a
table.
There is a global variable which I have to pass the value when
executing the package. Instead of passing a value I want the package to do
everything. All I have to do is ececute the package.
I created an sql task that will get a value form a table and then assign
it
to the global variable but, how do I assign it to the globalvariable so
that
the next tasg can pickup the
value form the global variable?

The order I have i is

1. SQL task object gets value form table and assign to global variable.
-------here I need help!
2. gets value form global variable and performs file import.

Thanks




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

Default Re: help assigning value to global variable - 06-13-2005 , 03:40 PM



The ExecuteSQL task does the assignment to a Global Variable.

What is the next task that uses the GV?



--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


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

Quote:
Hi,
I need to assign the result from my query to the global variable. example
(sql task in the package)

select id from table where name = 'test'

I then need to then pass that value in id to the global variable so the
second object in my dts would then pick up that value and continue.

"Allan Mitchell" wrote:

Text files will not support variables like this so you will need to
import
to a temp table first

As for reading a value from a table and inserting into a GV have a look
here

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277,7)


You want pages 7 and 8.

Whilst we use input parameters here you want an aoutput parameter of the
row
value so it may look like this your statement

SELECT SUM(column) as Val FROM TABLE

Make sense?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Chris" <Chris (AT) discussions (DOT) microsoft.com> wrote in message
news:E43F7248-D630-4980-8EC2-E687152F91BA (AT) microsoft (DOT) com...
Hi,
I have a dts package that reads a text file and enters the data in a
table.
There is a global variable which I have to pass the value when
executing the package. Instead of passing a value I want the package to
do
everything. All I have to do is ececute the package.
I created an sql task that will get a value form a table and then
assign
it
to the global variable but, how do I assign it to the globalvariable so
that
the next tasg can pickup the
value form the global variable?

The order I have i is

1. SQL task object gets value form table and assign to global variable.
-------here I need help!
2. gets value form global variable and performs file import.

Thanks






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

Default Re: help assigning value to global variable - 06-13-2005 , 04:24 PM



Hi,
The next task is a transform data task that takes data from a text file and
import it to a table. The transform data task takes data form the text file
based on the value of the Global Variable.

How does the ExecuteSQL task assign the value to the global variable?

"Allan Mitchell" wrote:

Quote:
The ExecuteSQL task does the assignment to a Global Variable.

What is the next task that uses the GV?



--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Chris" <Chris (AT) discussions (DOT) microsoft.com> wrote in message
news:F750E43C-3537-41F8-9CEB-E734D367DC25 (AT) microsoft (DOT) com...
Hi,
I need to assign the result from my query to the global variable. example
(sql task in the package)

select id from table where name = 'test'

I then need to then pass that value in id to the global variable so the
second object in my dts would then pick up that value and continue.

"Allan Mitchell" wrote:

Text files will not support variables like this so you will need to
import
to a temp table first

As for reading a value from a table and inserting into a GV have a look
here

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277,7)


You want pages 7 and 8.

Whilst we use input parameters here you want an aoutput parameter of the
row
value so it may look like this your statement

SELECT SUM(column) as Val FROM TABLE

Make sense?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Chris" <Chris (AT) discussions (DOT) microsoft.com> wrote in message
news:E43F7248-D630-4980-8EC2-E687152F91BA (AT) microsoft (DOT) com...
Hi,
I have a dts package that reads a text file and enters the data in a
table.
There is a global variable which I have to pass the value when
executing the package. Instead of passing a value I want the package to
do
everything. All I have to do is ececute the package.
I created an sql task that will get a value form a table and then
assign
it
to the global variable but, how do I assign it to the globalvariable so
that
the next tasg can pickup the
value form the global variable?

The order I have i is

1. SQL task object gets value form table and assign to global variable.
-------here I need help!
2. gets value form global variable and performs file import.

Thanks







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

Default Re: help assigning value to global variable - 06-13-2005 , 04:51 PM



I mentioned that in my first post. after you have defined your statement to
select the value from your table you then hit the <Parameters> button. You
want atable and then you will be able to use your GV on that. Row Value
output variable

You cannot use a GV against a text file as stated earlier the driver does
not support it. You will have to import the file into a staging

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


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

Quote:
Hi,
The next task is a transform data task that takes data from a text file
and
import it to a table. The transform data task takes data form the text
file
based on the value of the Global Variable.

How does the ExecuteSQL task assign the value to the global variable?

"Allan Mitchell" wrote:

The ExecuteSQL task does the assignment to a Global Variable.

What is the next task that uses the GV?



--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Chris" <Chris (AT) discussions (DOT) microsoft.com> wrote in message
news:F750E43C-3537-41F8-9CEB-E734D367DC25 (AT) microsoft (DOT) com...
Hi,
I need to assign the result from my query to the global variable.
example
(sql task in the package)

select id from table where name = 'test'

I then need to then pass that value in id to the global variable so the
second object in my dts would then pick up that value and continue.

"Allan Mitchell" wrote:

Text files will not support variables like this so you will need to
import
to a temp table first

As for reading a value from a table and inserting into a GV have a
look
here

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277,7)


You want pages 7 and 8.

Whilst we use input parameters here you want an aoutput parameter of
the
row
value so it may look like this your statement

SELECT SUM(column) as Val FROM TABLE

Make sense?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Chris" <Chris (AT) discussions (DOT) microsoft.com> wrote in message
news:E43F7248-D630-4980-8EC2-E687152F91BA (AT) microsoft (DOT) com...
Hi,
I have a dts package that reads a text file and enters the data in a
table.
There is a global variable which I have to pass the value when
executing the package. Instead of passing a value I want the package
to
do
everything. All I have to do is ececute the package.
I created an sql task that will get a value form a table and then
assign
it
to the global variable but, how do I assign it to the globalvariable
so
that
the next tasg can pickup the
value form the global variable?

The order I have i is

1. SQL task object gets value form table and assign to global
variable.
-------here I need help!
2. gets value form global variable and performs file import.

Thanks









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.