Go to Glossary Search VisualAge C++ Help Go to VisualAge C++ Help Home Page Go to WWW VisualAge C++ Site

Enter an SQL Statement for the Query

If you selected By entering an SQL statement, you have to type the SQL statement to create a schema mapping. Specify a table join or union. You can use column functions in your SQL statement.

If you have selected your tables in the previous page of the SmartGuide, you can view the table column names while you are typing in the SQL statement. Select one of the tables listed in the Tables Selected list and the table's column names are displayed in the Columns list.

To enter the SQL statement:

  1. Type the name of the query in the entry field. This name is used for the schema and for the default mapping.
  2. Type the SQL statement in the text box, for example:
    SELECT PROJNO, PROJNAME, DEPTNO, RESPEMP, LASTNAME, 
      SALARY+BONUS+COMM AS TOTAL_PAY FROM PROJECT, EMPLOYEE 
  3. Click Validate the SQL statement to validate the SQL statement against the database. An incorrect SQL statement brings up an error message window. Also, a technically correct SQL statement that returns no rows (for example, a "drop table" statement or a "insert into table" statement) brings up a message saying no columns were returned. Although the SQL may be correct, it is invalid for use as a schema definition in Data Access Builder. You must enter an SQL statement that returns a result set.

    Warning! If you are using DB2, the following lines must be in the DB2CLI.INI file in the SQLLIB directory, or else the validate action will return without an error message regardless of the SQL statement's actual validity:

    [common]
    DEFERREDPREPARE=0
  4. Click Finish to complete the mapping or Next>> to add a comment for the mapping.

If you select Finish, a mapping will be created for the SQL statement.



Data Access Builder Workflow
Table Joins and Query Support


Start the SmartGuide
Previous SmartGuide Step: Select Tables for Mapping
Next SmartGuide Step - Schema Mapping Description


Data Access Builder SmartGuide