FM.ExecuteSQL.LastParameters
----------------------------

Queries parameters from last failed SQL command.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [FM](component_FM.md) [FMSQL](component_FMSQL.md) | [16.2](newinversion162.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "FM.ExecuteSQL.LastParameters" ) ### Parameters

none

### Result

Returns JSON or error.

### Description

Queries parameters from last failed SQL command.  
This allows you to debug problems with MBS functions doing multi commands, so e.g. you can see which values the failed record for an insert.  
When an error happens, we serialize the parameters used for the SQL operation.  
Value is empty if no parameters have been recorded.  
  
See [FM.ExecuteSQL.LastSQL](FMExecuteSQLLastSQL.md) for the corresponding SQL statement and [FM.ExecuteSQL.LastErrorMessage](FMExecuteSQLLastErrorMessage.md) for the error message.  
### Examples

Try it:

 MBS ("[FM.InsertRecord](FMInsertRecord.md)"; ""; "NonExistingTable"; "test"; 123; "other"; "abc") &amp; ¶ &amp;  
MBS ("FM.ExecuteSQL.LastParameters")  
<small>  
Example result:   
\[MBS\] ERROR: FQL0002/(1:12): The table named "NonExistingTable" does not exist.  
\[123, "abc"\]</small>Check the last parameters after causing an error:

 Let(\[  
 sql = "INSERT INTO Test (FirstName, Age) VALUES (?,?)";  
 r = MBS ("[FM.ExecuteFileSQL](FMExecuteFileSQL.md)"; ""; sql; 9; 13; "Joe"; 23);  
 params = MBS ("FM.ExecuteSQL.LastParameters")  
\]; params)  
<small>  
Example result:   
\["Joe" , 23 \] </small>Build a JSON after causing an error:

 Let(\[  
 sql = "INSERT INTO Test (FirstName, Age) VALUES (?,?)";  
 r = MBS ("[FM.ExecuteFileSQL](FMExecuteFileSQL.md)"; ""; sql; 9; 13; "Joe"; 23);  
  
 errorCode = MBS ( "[FM.ExecuteSQL.LastError](FMExecuteSQLLastError.md)" );  
 errorMessage = MBS ("[FM.ExecuteSQL.LastErrorMessage](FMExecuteSQLLastErrorMessage.md)");  
 lastSQL = MBS ("[FM.ExecuteSQL.LastSQL](FMExecuteSQLLastSQL.md)");  
 params = MBS ("FM.ExecuteSQL.LastParameters");  
  
 json = JSONSetElement ( "{}" ;   
 \["Parameters"; params; JSONArray\];   
 \["ErrorCode"; errorCode; JSONNumber\];   
 \["SQL"; lastSQL; JSONString\];   
 \["ErrorMessage"; errorMessage; JSONString\])  
\]; JSONFormatElements ( json ))  
<small>  
Example result:   
{ "ErrorCode" : 8309 , "ErrorMessage" : "ERROR: FQL0002/(1:12): The table named \\"Test\\" does not exist." , "Parameters" : \[ "Joe" , 23 \], "SQL" : "INSERT INTO Test (FirstName, Age) VALUES (?,?)" } </small>### See also

- [FM.ExecuteFileSQL](FMExecuteFileSQL.md)
- [FM.ExecuteSQL](FMExecuteSQL.md)
- [FM.ExecuteSQL.LastError](FMExecuteSQLLastError.md)
- [FM.ExecuteSQL.LastErrorMessage](FMExecuteSQLLastErrorMessage.md)
- [FM.ExecuteSQL.LastSQL](FMExecuteSQLLastSQL.md)
- [FM.InsertRecord](FMInsertRecord.md)

### Release notes

- **Version 16.2**
    - Added [FM.ExecuteSQL.LastParameters](https://www.mbsplugins.eu/FMExecuteSQLLastParameters.shtml) function.

### Blog Entries

- [MBS FileMaker Plugin 16.2 News](https://www.mbsplugins.de/archive/2026-05-20/MBS_FileMaker_Plugin_162_News/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 16.2 für Claris FileMaker](https://www.mbsplugins.de/archive/2026-05-05/Neues_MBS_Plugin_162_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 16.2 for Claris FileMaker](https://www.mbsplugins.de/archive/2026-05-05/MBS_Plugin_162_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [SQL error checking improved](https://www.mbsplugins.de/archive/2026-04-30/SQL_error_checking_improved/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.2pr1](https://www.mbsplugins.de/archive/2026-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th March 2026 , last changed 27th April 2026

  
[FM.ExecuteSQL.LastErrorMessage](FMExecuteSQLLastErrorMessage.md) - [FM.ExecuteSQL.LastSQL](FMExecuteSQLLastSQL.md)

[HTML Version](FMExecuteSQLLastParameters.shtml)