Accessing external data sources > Querying an ODBC data source from FileMaker Pro
 
Querying an ODBC data source from FileMaker Pro
After configuring an ODBC client driver, you can interact with records, import records into an existing FileMaker Pro database file, or create a new FileMaker Pro database file from an ODBC data source (such as Oracle or Microsoft Access databases).
First, you access the data source you want to import from. Then you construct a query for the records you want to import from the data source. Finally, if you’re importing data into an existing file, you map fields from your data source to fields in your FileMaker Pro database file.
Important  See Connecting to external data sources for information on how you can access and work with ODBC data sources without writing SQL queries.
You can access your ODBC data source through the File menu, with the Import Records script step, or with the Execute SQL script step.
All applications that support ODBC recognize a basic subset of SQL (Structured Query Language) statements. SQL is passed through the ODBC interface to the data source, performing queries such as SELECT first_name, last_name FROM customers WHERE city=N'Paris' and making updates such as the creation of a new record with INSERT INTO customers (first_name, last_name) VALUES (N'Jane',N'Smith').
Note  Because Microsoft SQL Server supports both Unicode and non-Unicode field types, you must prefix all Unicode strings with an uppercase "N" (which stands for "National" in the SQL-92 standard). Otherwise, when a Unicode string containing non-English characters is passed to Microsoft SQL Server, you may lose any data that doesn’t exist in the Microsoft SQL Server code page.
To query an ODBC data source from FileMaker Pro:
1. In FileMaker Pro, do one of the following:
To import into an existing FileMaker Pro file, choose File menu > Import Records > ODBC Data Source.
To create a FileMaker Pro file from the data source records, choose File menu > Open. In the My Solutions tab in the Launch Center, click Browse. For Files of type (Windows) or Show (macOS), choose ODBC Data Source.
2. Choose your data source and click Continue.
Most server-based ODBC drivers require the data source to be open, but the requirement varies depending on the driver.
3. Enter the user name and password (if any) for the data source you chose.
To skip this dialog box in the future, select Save user name and password (this option is only available if you’re importing into an existing FileMaker Pro file).
4. Click OK.
The FileMaker Pro SQL Query builder dialog box appears.
5. Construct your query. See Constructing an SQL query for importing via ODBC for details.
You can execute the query immediately, or copy and paste it into a field for later use. Use the Import Records or Execute SQL script step to execute a query stored in a field. See Storing an SQL query in a field for details.
6. Click Execute.
If you are importing data into an existing file, FileMaker Pro displays the Import Field Mapping dialog box. You map fields from the data source to fields in your FileMaker Pro database file. See Setting the import action and mapping fields during import and Importing data into an existing file.
If you are importing data into a new file, FileMaker Pro puts the imported records into your database file.
Notes 
ODBC import, the Execute SQL script step, and external SQL data sources are not supported in runtime solutions created with FileMaker Pro Advanced.
Related topics 
Using ODBC and JDBC with FileMaker Pro
Configuring an ODBC client driver