# SQL

The `SQL` parameter specifies the query sent to the database. The rows returned by the query are transformed into documents.

If you are writing a SQL command to extract data from a sub-table, you can use the @ character to substitute data from the main table. For example:

    [Example]
    ConnectionString=...
    SQL=select * from orders
    PrimaryKeys=OrderID
    Template=C:\Autonomy\ODBCConnectorCFS\template.tmpl
    SubTables=Customers

    [Customers]
    Template=C:\Autonomy\ODBCConnectorCFS\customers.tmpl
    SQL=select * from Customers where CustomerID=@CustomerID

The connector runs the sub-table query for every row that is retrieved from the main table. In this example, the connector replaces`@CustomerID` with the value of the `CustomerID` column from the main (`orders`) table.

NOTE: If you want the connector to report the progress of synchronize tasks, the value of the `SQL` parameter (for the main table) must not include an ORDER BY clause.

Type: | String
Default: |
Required: | Yes
Configuration Section: | Any section named by SubTables, or TaskName or FetchTasks
Example: | `SQL=SELECT * FROM table`
See Also: | AddedAndUpdatedStatement DeletedStatement UseIncrementalStatements

_FT_HTML5_bannerTitle.htm