Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple default databases?

Status
Not open for further replies.

CapsuleCorpJX

IS-IT--Management
Jun 23, 2004
70
US
lets say I have an application that accesses two databases (or schemas/regions):

TEST1
TEST2

Is there a way to set the default database to BOTH of those regions? Say if I execute a macro, Teradata will automatically determine where the macro is found, and execute it:

TEST1.macro1
TEST2.macro2

"EXEC macro2"
translates to: "EXEC TEST2.macro2
 
No. Macros are automatically fully qualified before they are stored

if you are default database John and execute

create macro m1 as ( sel * from t2 ; );

the Macro is expanded to

create macro john.m1 as ( sel * from john.t2 ; );

before it is stored. therefore no matter who executed john.m1 they will always reference John.t2.


now as a sideline that if you have a query like....

sel * from t1, bob.t2;

we will search both John and Bob for t1.

However that doesn't work in a macro because which ever one it qualifies to when the macro is created/replaced will be the one the macro uses forever ( or at least until it is replaced ).


---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top