| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
Matrix.InsertOrUpdateRecordsToSQL
Insert or updates a lot of records queried from a database.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| Matrix | 16.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Matrix.InsertOrUpdateRecordsToSQL"; MatrixRef; Connection; InsertTableName; FieldNames; KeyFieldMapping ) More
Parameters
| Parameter | Description | Example |
|---|---|---|
| MatrixRef | The matrix reference number. | $matrix |
| Connection | The connection reference number gained with SQL.NewConnection. | $Connection |
| InsertTableName | The name of the table to insert record into. Can be ID of table, so we lookup name by ID. Can be result of GetFieldName() function as we remove field name automatically. |
"Assets" |
| FieldNames | A list of field names for the insert. Empty entries in the list are ignored. Can be ID of field, so we lookup name by ID. Can be result of GetFieldName() function as we remove table name automatically. |
"Model" |
| KeyFieldMapping | The list of field names with index to map keys. Please specify a list of key name=key index. The key name is the name of the field in the insert table and the index gives zero-based position in result set from SELECT query in 6th parameter. Field order in source and destination does not need to be the same. |
ID=0 |
Result
Returns OK or error.
Description
Insert or updates a lot of records queried from a database.Reports an error if field name list doesn't match column count of the matrix.
Examples
Insert or update to SQL database:
Set Variable [ $InsertFields ; Value: "Key¶TextField¶NumberField¶DateField¶TimeField¶TimestampField¶ContainerField¶Description" ]
Set Variable [ $result ; Value: MBS("Matrix.InsertOrUpdateRecordsToSQL"; $sql; $Connection; "Test"; $InsertFields; "Key=0") ]
Set Variable [ $result ; Value: MBS("Matrix.InsertOrUpdateRecordsToSQL"; $sql; $Connection; "Test"; $InsertFields; "Key=0") ]
See also
Release notes
- Version 16.1
- Added FM.SQL.InsertOrUpdateRecordsToSQL and Matrix.InsertOrUpdateRecordsToSQL functions.
Blog Entries
This function checks for a license.
Created 27th January 2026, last changed 12nd February 2026