| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
FM.ExecuteSQL.LastError
Queries the last error code from an SQL call
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| FM FMSQL | 1.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "FM.ExecuteSQL.LastError" )
Parameters
none
Description
Queries the last error code from an SQL callSet by FM.InsertRecord, FM.SQL.Execute, FM.ExecuteSQL, FM.ExecuteFileSQL, FM.ExecuteSQLOnIdle and other SQL related functions.
In general error 8309 is a semantic error, so something is wrong in your SQL. 8310 is a syntax error, something in the SQL is not correctly parsed.
Error 8309 means you did pass wrong data type, like string for a number.
See also FM.ExecuteSQL.LastErrorMessage.
Examples
Get Last SQL Error
MBS( "FM.ExecuteSQL.LastError")
Get the last error code:
Let([
sql = "SELECT * FROM Test";
r = MBS("FM.ExecuteFileSQL"; ""; sql);
errorCode = MBS( "FM.ExecuteSQL.LastError" )
]; errorCode)
Example result: 8309
sql = "SELECT * FROM Test";
r = MBS("FM.ExecuteFileSQL"; ""; sql);
errorCode = MBS( "FM.ExecuteSQL.LastError" )
]; errorCode)
Example result: 8309
See also
- FM.ExecuteSQL.LastSQL
- FM.InsertRecordTSV
- FM.SQL.Execute
- FM.SQL.InsertRecords
- JSON.Import
- Matrix.InsertOrUpdateRecords
- Matrix.InsertRecords
- SQL.Execute
- SQL.InsertOrUpdateRecords
- XML.Import
Example Databases
Blog Entries
- SQL error checking improved
- MBS FileMaker Advent calendar - Door 13 - Last SQL
- MBS FileMaker Advent calendar - Door 8 - Error handling
- Storing data in the FileMaker schema
- Comparing Base Elements Plugin to MBS FileMaker Plugin
- ExecuteSQL and getting error details
- MBS Filemaker Plugin, version 4.2pr5
- MBS Filemaker Plugin, version 3.2pr2
FileMaker Magazin
This function is free to use.
Created 18th August 2014, last changed 25th June 2026
MarkDown version: FMExecuteSQLLastError.md