Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
Matrix.InsertRecordsToSQL
Inserts records in SQL database from records in memory.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| Matrix | 9.2 | Yes | Yes | Yes | Yes | Yes |
MBS( "Matrix.InsertRecordsToSQL"; MatrixRef; Connection; InsertTableName; FieldNames { ; StartRow; EndRow; Replace } ) More
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| 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. | "Assets" | |
| FieldNames | A list of field names for the insert. Empty entries in the list are ignored. |
"Model¶Names" | |
| StartRow | The index of the start row. First row is 0. Pass -1 or nothing for default which is starting with row 0. |
-1 | Optional |
| EndRow | The index of the end row. First row is 0. Last Row would be FM.SQL.RowCount-1. Pass -1 to use all rows and the plugin will internally use RowCount-1. |
-1 | Optional |
| Replace | Set to 1 to replace existing entries. Currently available for MySQL and databases with same syntax. |
0 | Optional |
Result
Returns OK or error.
Description
Inserts records in SQL database from records in memory.This function allows to easily copy a lot of records from a query in FileMaker database into a SQL database.
Please provide field names in other table. The order has to match those in the record set.
Due to passing in new field names, you can even rearrange values from one column to other while copying. In the SQL you can use functions for sums or join data from several tables together to fill a new table.
Reports an error if field name list doesn't match column count of the query result.
Function will fail if data types in source and dest fields do not match for assignment. e.g. date and time fields will not work, only timestamp fields.
For insert within FileMaker, please use Matrix.InsertRecords.
See also
Created 8th April 2019, last changed 8th April 2019
Matrix.InsertRecords - Matrix.JSONRecord
Feedback: Report problem or ask question.
Links
MBS FileMaker blog