Q

Querying system catalog tables to determine table alias

In order to determine the alias of a table in DB2 on i, you can query the system catalog tables. AS/400 expert Kent Milligan shares how.

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, 

base_table_schema
FROM qsys2.systable
WHERE table_type='A'
and table_name='MYALIAS';
This was first published in July 2008

Dig deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

SearchEnterpriseLinux

SearchDataCenter

Close