Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to find the tables names.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ramanatcs

New User


Joined: 23 Dec 2008
Posts: 7
Location: Bangalore

PostPosted: Tue Jan 20, 2009 5:39 pm    Post subject: How to find the tables names.
Reply with quote

Hi All,

I want to retrieve the table names which contains the value as ‘Germany’ in different fileds of tables.

Suppose.
Table1
Column1 Column2 Column3 Column4 Column5
India
Germany
USA
Germany

Table3
Column1 Column2 Column3 Column4 Column5
Germany
Lonon
Germany
Japan

Table3
Column1 Column2 Column3 Column4 Column5
Australia
Lonon
Germany
Japan

-
-
-
-
-

upto 50 tables are there. I want to retrieve the table names out of 50 which contains 'Germany' as a column value.

Write a single SQL query. There is no key columns in all the tables.

Hope I am clear.
Thanks in advance
Back to top
View user's profile Send private message

abhishek dadhichi

New User


Joined: 19 Apr 2007
Posts: 37
Location: Bangalore

PostPosted: Tue Jan 20, 2009 5:53 pm    Post subject:
Reply with quote

Hi ramanatcs,

Plz try the following query:

sel * from dbc.tables where column_name=germany





Thanks,
Abhishek
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7996
Location: Bellevue, IA

PostPosted: Tue Jan 20, 2009 6:26 pm    Post subject:
Reply with quote

Dick, can I vote for the answer? Since it doesn't meet the stated requirements, it can't really be considered an answer to the question. Although the question is lame, at least the person is wanting help.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jan 20, 2009 8:09 pm    Post subject:
Reply with quote

you are right, Robert.

If I had edit authority on this board I would amend/delete my post. Done

as far as an answer to the OP's question, I don't know how to extract the table name and validate a table column's value for 50 tables in one SQL.
Code:

Select 'table name one'
   from table-name-one
 where column = 'Germany'
UNION
Select 'table name two'
   from table-name-two
 where column = 'Germany'
...
UNION
Select 'table name 50'
   from table-name-50
 where column = 'Germany'



maybe someone else can provide an answer.

I apologize to ramanatcs and Abhishek. My previous post was needlessly rude and did not contribute to the thread.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jan 20, 2009 9:45 pm    Post subject:
Reply with quote

Hello,

Quote:
Write a single SQL query.
Why? Probably because "I want. . .". Maybe it is some homework assignment.

Given the complete lack of specification of what is really needed (it appears to be a list of every table that has the word "Germany" anywhere in the table?), one way might be to unload the tables and scan the unloaded output for the word "Germany".
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts To know activities on db2 tables ashek15 DB2 4 Fri Mar 03, 2017 11:23 pm
No new posts ERM-Diagram of SysIBM-Catalog-Tables Auryn DB2 2 Fri Feb 17, 2017 6:22 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us