Schedule.ExecuteSQLAfterDelay
-----------------------------

Runs a SQL query in any open FileMaker file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Schedule](component_Schedule.md) | [5.2](newinversion52.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "Schedule.ExecuteSQLAfterDelay"; DelaySeconds; FileName; SQL Statement { ; ScriptFileName; ScriptName; Column Delimiter; Record Delimiter; Params... } ) 

**MBS**( **"Schedule.ExecuteSQLAfterDelay";** /\* Runs a SQL query in any open FileMaker file. \*/  
**$DelaySeconds**; /\* The Number of Seconds to wait before running the script.e.g. 10 \*/   
**$FileName**; /\* The target database name. Can be empty to not limit query to one database.e.g. "" \*/   
**$SQL Statement**; /\* SQL Statement as a Text string \*/   
**$ScriptFileName**; /\* Optional; The name of the file that contains the script to be run.e.g. Get(Filename) \*/   
**$ScriptName**; /\* Optional; The exact name of the script to run.e.g. "TestScript" \*/   
**$Column Delimiter**; /\* Optional; Columns Separator.   
Default is tab character, which has unicode code point 9.  
You can pass delimiter as text (one character only) or as unicode code point (as number).e.g. 9 \*/   
**$Record Delimiter**; /\* Optional; Record Separator.  
Default is return character, which has unicode code point 13.  
You can pass delimiter as text (one character only) or as unicode code point (as number).e.g. 13 \*/   
**$Params...**) /\* Optional; Optional, pass here parameters. One parameter to this function for each parameter you want to pass to the SQL statement.e.g. 123 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| DelaySeconds | The Number of Seconds to wait before running the script. | 10 |  |
| FileName | The target database name. Can be empty to not limit query to one database. | "" |  |
| SQL Statement | SQL Statement as a Text string |  |  |
| ScriptFileName | The name of the file that contains the script to be run. | Get(Filename) | Optional |
| ScriptName | The exact name of the script to run. | "TestScript" | Optional |
| Column Delimiter | Columns Separator.    Default is tab character, which has unicode code point 9.   You can pass delimiter as text (one character only) or as unicode code point (as number). | 9 | Optional |
| Record Delimiter | Record Separator.   Default is return character, which has unicode code point 13.   You can pass delimiter as text (one character only) or as unicode code point (as number). | 13 | Optional |
| Params... | Optional, pass here parameters. One parameter to this function for each parameter you want to pass to the SQL statement. | 123 | Optional |

### Result

Returns reference number or error.

### Description

Runs a SQL query in any open FileMaker file.   
Optional, we can start a script with the result of the query.  
Please use [Schedule.Release](ScheduleRelease.md) later to remove schedule from list. Non repeating scheduled items are free automatically for you.   
Our plugin does not provide persistence. You need to schedule things in your scripts if you need them. When FileMaker quits, the plugin forgets the list of schedules.  
Unless you call [Schedule.Check](ScheduleCheck.md) to perform due schedules now, the schedules are performed at idle time, so all the SQL commands are available including INSERT, DELETE, UPDATE and even ALTER TABLE.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat Params parameter as often as you need.  
  
  
With plugin version 6.0 or newer the script name can be a script ID number. In that case the plugin queries the script name for the given script ID. This allows to call scripts by ID and avoid problems if scripts are later renamed.  
  
Notice: FileMaker 19.2 adds a fmplugin extended privileges. If you have such an extended privileges to allow the plugin to trigger scripts, you need to grant permissions for it. If such a privilege is not defined, the plugin is allowed to trigger scripts. See FileMaker product documentation for details.  
### See also

- [Schedule.Check](ScheduleCheck.md)
- [Schedule.EvaluateAfterDelay](ScheduleEvaluateAfterDelay.md)
- [Schedule.ExecuteSQLAtTime](ScheduleExecuteSQLAtTime.md)
- [Schedule.ExecuteSQLAtTimeStamp](ScheduleExecuteSQLAtTimeStamp.md)
- [Schedule.Release](ScheduleRelease.md)

### Example Databases

- [Schedules/Schedules](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Schedules/Schedules.shtml#1GroupButton42.0000000333.000000067.0000000514.0000000LayoutObjectAnchor_)

This function checks for a license.

Created 20th May 2015 , last changed 29th April 2026

  
[Schedule.EvaluateOnIdle](ScheduleEvaluateOnIdle.md) - [Schedule.ExecuteSQLAtTime](ScheduleExecuteSQLAtTime.md)

[HTML Version](ScheduleExecuteSQLAfterDelay.shtml)