Storing an SQL query in a field

You can store an SQL query in a text field for use with the Import Records script step or Execute SQL script step.

To store a query in a field, do one of the following:

  • Type a query directly into a field.

  • Create a query dynamically in a calculation field.

  • Use the SQL Query builder to construct a query, then copy and paste it into a field.

Notes 

  • When you execute a stored query, error checking is performed at runtime only. Use Get(LastError) function, and then use Get(LastErrorDetail) function to return the last readable error string that is generated by the ODBC driver.

  • The SQL Query builder validates queries for use only with FileMaker Pro.

  • You can store and execute a different query in each record of your database file.

  • You can store a query in a global field to guarantee the same query is executed regardless of which record you are on.