All functions
Mac OS X
Windows
Crossplatform
Components
New in version:
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
2.0
2.1
2.2
2.3
2.4
2.5
FM.ExecuteSQL
Component: FM
Version: 1.2
Mac OS X: Works
Windows: Works
MBS( "FM.ExecuteSQL" ; SQL Statement; Column Delimiter; Record Delimiter )
Parameters
| Parameter | Description | Example value |
|---|---|---|
| SQL Statement | SQL Statement as a Text string | |
| Column Delimiter | Columns Separator, only used with SELECT statement. Default is TAB | "" |
| Record Delimiter | Record Separator, only used with SELECT statement, Default is Return |
Description
Execute the SQL Statement against the current FileMaker File.There must be an occurrence of the Table on the current tables' Graph. SELECT returns the the records in as a tabbed delimited text string. All other SQL commands return "". Use FM.ExecuteSQL.LastError to check for errors. Supported Commands SELECT UPDATE (see limitation below) DELETE INSERT CREATE TABLE DROP TABLE CREATE INDEX DROP INDEX WHERE clause are Case Senstive! WHERE First_Name="todd" will not find records that have "Todd" in the first Name Field. You can wrap the field you are searching for with "lower" like this WHERE lower(First_Name)="todd" KNOWN LIMITATIONS Schema editing SQL functions are not supported in FileMaker 8 and 8.5. Record Locking Errors are Not Reported! This means you must exercise caution when using UPDATE. CAUTION! This is a very powerful function! It is relying on very new and relatively untested resources made available by the release of FileMaker 8.
Seems like on Filemaker 11 you get LastError 8310 if you use fields with underscore in the name. You avoid that by placing the field names in quotes.
Examples
SELECT records
MBS("FM.ExecuteSQL";"select * from Contacts")
INSERT record
MBS("FM.ExecuteSQL";"INSERT INTO Contacts (FirstName, LastName) Values('Todd', 'Geist')")
Select records using delimiters
MBS("FM.ExecuteSQL";"select * from Contacts"; "#"; "|")
SELECT records with a Where clause
MBS("SELECT First_Name, Last_Name from Contacts WHERE ID_Contact_PK ='CN10013'")
Feedback: Report problem or ask question.
Links
MBS REAL studio tutorial videos - Pfarrgemeinde Ministranten Nickenich