Execute SQL
 
Purpose 
Executes any SQL statement on an ODBC data source.
See also 
Format 
Execute SQL [No Dialog; ODBC: <datasource name>; <native SQL
or calculated SQL>
]
Options 
 •
Perform without dialog prevents the Specify SQL dialog box, the Select ODBC Data Source dialog box, and the Password dialog box from displaying when the script step executes.
 •
ODBC Data Source displays the Select ODBC Data Source dialog box. Select a data source from the list, click OK, and enter a valid user name and password.
Note  Select Save user name and password if you selected Perform without dialog, or users may be unable to access your data source.
 •
Calculated SQL text specifies a calculation to use as the SQL query.
 •
SQL text lets you manually enter a SQL query statement.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server scheduled script 
Partial 
FileMaker Go 
No 
Custom Web Publishing 
Partial 
FileMaker WebDirect 
Partial 
Runtime solution 
No 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
You can use this script step to manage data in an ODBC data source through an ODBC SQL interface. This provides more control over the FileMaker Pro interaction with ODBC data sources. You can add multiple Execute SQL steps to a script.
Important  See Get functions for information about error handling.
 •
Get(LastODBCError) function returns the latest error state returned by ODBC.
 •
Get(LastError) function returns the last FileMaker Pro error.
Notes
 •
 •
 •
 •
 •
Example 1 
Updates records in the Employees table of an external ODBC data source.
Execute SQL [SQL Text: INSERT INTO Employees (EmployeeID, FirstName, LastName, Title, WorkPhone, Salary) VALUES (100, N'Joe', N'Smith', N'Software Engineer', '987-7000', 100000) UPDATE Employees SET Title = N'Manager' WHERE EmployeeID = 103 DELETE FROM Employees WHERE EmployeeID = 103]
Example 2 
Calculates and performs an SQL statement to update records in the Customers table of an external ODBC data source.
Execute SQL [Calculated SQL Text: "INSERT INTO Customers (Company, LastName) VALUES (" & Customers::Company & "," & "N'" & Customers::Last & "')"]
Related topics 
Script steps reference (alphabetical list)
Script steps reference (category list)