Super n00b question, I know, but I can't seem to find it anywhere that's easy to find, so it would be good to document this here.
Say I connect to a Teradata system as a particular user, NICK
, but I need to access tables owned by a different user, BOB
.
Instead of having to qualify each table name with BOB.
I'd like to just set my default database for the connection to BOB
and then query the tables using their unqualified name.
In other words, instead of this:
-- Cartesian Join of Doom (CJD™)
SELECT COUNT(*)
FROM BOB.TABLE1, BOB.TABLE2, BOB.TABLE3;
I want to be able to do this:
-- CJD™ for the lazy
SELECT COUNT(*)
FROM TABLE1, TABLE2, TABLE3;
Is there a way to do this for the life of a connection?
Best Answer
You just need to issue:
Similar to an
alter session set current_schema
in oracle.