Ask the Expert

Querying system catalog tables to determine table alias

How do I know the current alias of the table in DB2 UDB environment? Since the database has three physical tables -- Tablename_1, Tablename_2 and Tablename_3. I need to query on the table that is currently pointing. Can an SQL query help me?
On DB2 for i, this can be done by querying the system catalog tables with a query like the following:

SELECT base_table_name, 

FROM qsys2.systable
WHERE table_type='A'
and table_name='MYALIAS';

This was first published in July 2008

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: