Retrieving SQL table data
EGL provides a way to create SQL record items from the definition of an SQL table, view, or join; for an overview, see SQL support.
Do as follows:
- Ensure that you have set SQL preferences as appropriate. For details, see and Setting preferences for SQL retrieve.
- Decide where to do the task--
- In an EGL source file, as you develop each SQL record; or
- In the Outline view, as may be easier when you already have SQL records.
- If you are working in the EGL source file, proceed in this way--
- If you do not have the SQL record, create it:
- Type R, press Ctrl-Space, and in the content-assist list, select one of the SQL table entries (usually SQL record with table names).
- Type the name of the SQL record; press Tab; and type a table name, or a comma-delimited list of tables, or the alias of a view.
You also can create an SQL record by typing the minimal content, as appropriate if the name of the record is the same as the name of the table, as in this example:
Record myTable type sqlRecord end- Right-click anywhere in the record.
- In the context menu, click SQL record > Retrieve SQL.
- If you are working in the Outline view, right click on the entry for the SQL record and, in the context menu, click Retrieve SQL.
Note: You cannot retrieve an SQL view that is defined with the DB2 condition WITH CHECK OPTIONS.
After you create record items, you may want to gain a productivity benefit by creating the equivalent dataItem parts; see Overview on creating dataItem parts from an SQL record part.
Related concepts
Creating dataItem parts from an SQL record part (overview)
SQL support
Related tasks
Creating dataItem parts from an SQL record part
Setting preferences for SQL database connections
Setting preferences for SQL retrieve
Related reference
SQL item properties