dbTalk Databases Forums  

Use Global Parameters as table names?

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


Discuss Use Global Parameters as table names? in the microsoft.public.sqlserver.dts forum.



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

Default Use Global Parameters as table names? - 08-05-2004 , 04:50 AM






Hi all,

I have several DTS packages for transforming and loading data from one
database to another. The packages transform data in a staging Db and
then load it into the final Db. Each package contains several SQL
Tasks, and within each of those tasks are several SQL Queries. The
queries point to both databases (within the same SQL task), and
therefore each SELECT/UPDATE/DELETE etc. statement refers to the full
table name - databasename.dbo.tablename. The problem I have is that
when I transfer the packages from one environment to another, i.e.
from Development to Test, I have to go through every task and manually
change the table references in each query.

Is there any way I can place the database name in a global variable
within the DTS package, and then write each query so that it refers to
the variable as part of the table name (SELECT Field from
@db_name.dbo.tablename, for example)? It would make life much easier
if I only had to change the two variables containing the database
names, as opposed to each query individually!

Thanks for any suggestions/help.

Cheers,

Paul.

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Use Global Parameters as table names? - 08-05-2004 , 05:08 AM






Try-

Global Variables and SQL statements in DTS
(http://www.sqldts.com/default.aspx?205)


--
Darren Green
http://www.sqldts.com

"Paul" <paulhodgson24 (AT) hotmail (DOT) com> wrote

Quote:
Hi all,

I have several DTS packages for transforming and loading data from one
database to another. The packages transform data in a staging Db and
then load it into the final Db. Each package contains several SQL
Tasks, and within each of those tasks are several SQL Queries. The
queries point to both databases (within the same SQL task), and
therefore each SELECT/UPDATE/DELETE etc. statement refers to the full
table name - databasename.dbo.tablename. The problem I have is that
when I transfer the packages from one environment to another, i.e.
from Development to Test, I have to go through every task and manually
change the table references in each query.

Is there any way I can place the database name in a global variable
within the DTS package, and then write each query so that it refers to
the variable as part of the table name (SELECT Field from
@db_name.dbo.tablename, for example)? It would make life much easier
if I only had to change the two variables containing the database
names, as opposed to each query individually!

Thanks for any suggestions/help.

Cheers,

Paul.



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.