By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,226 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,226 IT Pros & Developers. It's quick & easy.

Find my aliases

P: n/a

I have created several aliases to members using the CREATE ALIAS
command, but I lost track of them.

Now I want to see a catalog of all the aliases mapped to all members in
a FILE.

Is there a SQL commmand I can issue to see these?
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
As always such information is stored in system catalogs:

select tabschema, tabname, base_tabschema, base_tabname from
syscat.tables where type = 'A'
You can export from that select to a file.

If you created aliases to aliases to find the real table names you need
to write recursive query ("with temp1" clause -- search in goole for
DB2 SQL Cookbook).

-- Artur Wronski

Nov 12 '05 #2

P: n/a
John Bailo wrote:

I have created several aliases to members using the CREATE ALIAS
command, but I lost track of them.

Now I want to see a catalog of all the aliases mapped to all members in
a FILE.

Is there a SQL commmand I can issue to see these?


Look in the system catalog table QSYS2/SYSTABLES.
There's some column in there (can't recall the name)
that identifies whether it's a table or alias.
Nov 12 '05 #3

P: n/a
select tabschema, tabname, base_tabschema, base_tabname from syscat.tables where type = 'A'

SQL State: 42704
Vendor Code: -204
Message: [SQL0204] TABLES in SYSCAT type *FILE not found. Cause . . . .
.. : TABLES in SYSCAT type *FILE was not found. If this is an ALTER
TABLE statement and the type is *N, a constraint or partition was not
found. If this is not an ALTER TABLE statement and the type is *N, a
function, procedure, or trigger was not found. If a function was not
found, TABLES is the service program that contains the function. The
function will not be found unless the external name and usage name do
not match exactly. Examine the job log for a message that gives more
details on which function name is being searched for and the name that
did not match. Recovery . . . : Change the name and try the request
again. If the object is a node group, ensure that the DB2 Multisystem
product is installed on your system and create a nodegroup with the
CRTNODGRP CL command. If an external function was not found, be sure
that the case of the EXTERNAL NAME on the CREATE FUNCTION statement
exactly matches the case of the name exported by the service program.

Processing ended because the highlighted statement did not complete
successfully

Artur wrote: As always such information is stored in system catalogs:

select tabschema, tabname, base_tabschema, base_tabname from
syscat.tables where type = 'A'
You can export from that select to a file.

If you created aliases to aliases to find the real table names you need
to write recursive query ("with temp1" clause -- search in goole for
DB2 SQL Cookbook).

-- Artur Wronski

Nov 12 '05 #4

P: n/a
John Bailo wrote:
> select tabschema, tabname, base_tabschema, base_tabname from

syscat.tables where type = 'A'

SQL State: 42704
Vendor Code: -204
Message: [SQL0204] TABLES in SYSCAT type *FILE not found. Cause . . . .


Then you probably want to tell us on which platform you are running and
which version of DB2 you are using. The above query works quite fine on
DB2 for Linux, Unix and Windows.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.