471,887 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

Find my aliases


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
4 15889
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
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
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
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.

Similar topics

9 posts views Thread by P | last post: by
5 posts views Thread by Kevin | last post: by
reply views Thread by Krzysiek | last post: by
67 posts views Thread by PC Datasheet | last post: by
15 posts views Thread by jacob navia | last post: by
22 posts views Thread by Daniel Rucareanu | last post: by
6 posts views Thread by dom.k.black | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.