If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SHOW View definition?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-04, 03:35
john_wsm john_wsm is offline
Registered User
 
Join Date: Mar 2004
Posts: 33
Arrow SHOW View definition?

Hi folks,

is there a command which can show the definition of a view (i.e. show
the actual SQL that created in the view)?

much thanks
ME
Reply With Quote
  #2 (permalink)  
Old 04-14-04, 03:45
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
GUI or Shell ?

Yes you can.

If you are using a GUI interface (java)
just rklick on the view, select change
and rip off the creation code.

On Unix/AIX/Linux you can use
the db2look utility and specify
the view as a table.

BOW
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #3 (permalink)  
Old 04-14-04, 03:47
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
The db2look utiliy will produce DDL for a database, including views (with the -e option). See the Command Reference for information on the parms to use.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 04-14-04, 03:54
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
What I meant is that
the db2look utility treats
views as tables, so use
the -t <myview> switch
to limit your output.
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #5 (permalink)  
Old 04-14-04, 08:09
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
SELECT TEXT
FROM SYSCAT.VIEWS
WHERE VIEWNAME = 'myview' and viewschema = 'myschema'
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #6 (permalink)  
Old 04-14-04, 08:13
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Smile

Nice one, hadn't seen that before!
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On