AX3303

Creating the SQL SELECT statement

If the import source is an external database or an internal database, then you must define a SQL SELECT statement to query the source database, resulting in the set of data to be imported to the temp table.

You can use the Edit SQL dialog to create and test the SELECT statement. To open the dialog:

  • On the Source tab of the Import Wizard, click the browse button (...) to the right of the SQL Select Statement box.

The Edit SQL dialog provides a text editor for the statement, and also several tools to help create and test the statement.

Creating the statement

You can type the statement into the text editor, or copy and paste from another source.

You can use the Choose Table tool to automatically generate a SQL statement that selects all columns in a specified table. You can then edit the statement to meet the specific data needs. To do this:

  1. Click the Choose source table to create SQL button .
  2. In the Choose Table dialog, select the table for which to generate the SQL statement, and then click OK.

    The Choose Table dialog lists all tables in the SQL Server database specified on the Source tab, including views.

The generated SELECT statement is placed in the text editor. Any existing text in the editor is overwritten.

Testing the statement

NOTE: If the SQL statement uses variables, then these validation features are not available. Validation features are also not available if the source is OLEDB.

To validate the syntax of the SQL statement, click the Check SQL syntax button . Axiom Software sends the statement to your database server to see if the statement can be parsed, resulting in either a success message or an error message.

To view a set of sample records, click the View data button . Axiom Software queries the database and returns the first 100 rows in the View Data dialog. You can review this data to help determine if the SELECT statement is returning the desired set of data.

Within the View Data dialog, you can sort, filter, and group the sample data using standard Axiom grid functionality. If desired, you can click the Export data to .CSV file button to export the data to a CSV file .

When you are finished reviewing the data, click Close to return to the Edit SQL dialog.