Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4    Statistic  


Executes the current command.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
SQL 2.6 Yes Yes Yes Yes Yes

MBS( "SQL.Execute"; Command )


Parameter Description Example value
Command The command reference number gained with SQL.NewCommand. $Command


Returns "OK" or error message.


Executes the current command.

Use the Execute method to execute the query or stored procedure specified in the command text. Execute method calls Prepare method implicitly if needed. If the command has input parameters, they should be bound before calling Execute method. Input parameters represented by param object. To bind input variables, use the SetParam commands.
A command (an SQL statement or procedure) can have a result set after executing. To check whether a result set exists use SQL.isResultSet method. If result set exists, a set of Field objects is created after command execution. Rows from the result set can be fetched one by one using SQL.FetchNext method. To get field description or value use Field method.

Output parameters represented by param objects. They are available after command execution.


Executes a command:

MBS("SQL.Execute"; $Command)

Create a table:

// create comand
$Command = MBS("SQL.NewCommand"; $Connection; "CREATE TABLE Test(FirstName VARCHAR, LastName VARCHAR, Birthday date, NumberOfOrders integer, TotalSales double)"
// run it
$result2 = MBS("SQL.Execute"; $Command)
// commit changed
$result3 = MBS("SQL.Commit"; $Connection)
// and free command
$result4 = MBS("SQL.FreeCommand"; $Command)

See also

Example Databases

Created 18th August 2014, last changed 12nd June 2015

SQL.Disconnect   -   SQL.FetchFirst

Feedback: Report problem or ask question.

MBS Xojo blog