20 pts.
 How can I see SQL VIEW inside ?
Dear Friend, I see the VIEWS on AS/400 as logical file,but I don't know wit which SQL it is created. How can I see the SQL Sentence of this VIEW ?

Software/Hardware used:
AS/400
ASKED: November 4, 2010  1:32 PM
UPDATED: November 9, 2010  7:10 AM

Answer Wiki:
Simplest might be to use the DSPFD command. A SQL VIEW will show the related CREATE VIEW statement in the file description. If the definition is needed in SQL itself, you can possibly query the SYSVIEWS table in QSYS2. A more standard way might be to query VIEWS in the SYSIBM library. Tom thank you very much
Last Wiki Answer Submitted:  November 8, 2010  4:22 pm  by  TomLiotta   108,105 pts.
All Answer Wiki Contributors:  TomLiotta   108,105 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Also, are you sure that these are SQL VIEWs?

A SQL VIEW is implemented as a derivative type of logical file on AS/400s. But not all logical files are SQL VIEWs. A logical file might not have been created with SQL — there might be no SQL statement to see.

Tom

 108,105 pts.

 

Also you can use iseries Navigator to generate the SQL used to create the View.

 115 pts.

 

…the SQL used to create the View.

Assuming that SQL was used to create the LF, what comes out should be effectively what went in. You can test that by viewing the ‘Query Text’ tab of the Definition context-menu item.

But if SQL wasn’t used, you’ll only get the nearest approximation.

Tom

 108,105 pts.