SQL.FreeCommand
---------------

Frees the command and releases all memory associated with it.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SQL](component_SQL.md) | [2.6](newinversion26.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "SQL.FreeCommand"; Command ) 

**MBS**( **"SQL.FreeCommand";** /\* Frees the command and releases all memory associated with it. \*/  
**$Command**) /\* The command reference number gained with [SQL.NewCommand](SQLNewCommand.md). \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Command | The command reference number gained with [SQL.NewCommand](SQLNewCommand.md). | $Command |

### Result

Returns "OK" or error message.

### Description

Frees the command and releases all memory associated with it.  
### Examples

Free command object:

 MBS ( "SQL.FreeCommand"; $Command )  
### See also

- [SQL.GetFieldAsText](SQLGetFieldAsText.md)
- [SQL.GetFieldsAsJSON](SQLGetFieldsAsJSON.md)
- [SQL.GetParamsAsJSON](SQLGetParamsAsJSON.md)
- [SQL.InsertOrUpdateRecords](SQLInsertOrUpdateRecords.md)
- [SQL.InsertRecords](SQLInsertRecords.md)
- [SQL.NewCommand](SQLNewCommand.md)
- [SQL.ResetCommand](SQLResetCommand.md)
- [SQL.SetParamAsContainer](SQLSetParamAsContainer.md)
- [SQL.SetParamTypesValues](SQLSetParamTypesValues.md)
- [SQL.SetParamValues](SQLSetParamValues.md)

### Release notes

- **Version 9.3**
    - Fixed potential crash with [SQL.FreeCommand](http://www.mbsplugins.eu/SQLFreeCommand.shtml) and [SQL.FreeConnection](http://www.mbsplugins.eu/SQLFreeConnection.shtml) in server scripts.

### Example Databases

- [SQL to other databases/DuckDB Query](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/DuckDB%20Query.shtml#1ScriptAnchor_)
- [SQL to other databases/Firebird Query](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/Firebird%20Query.shtml#1ScriptAnchor_)
- [SQL to other databases/Microsoft SQL Execute](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/Microsoft%20SQL%20Execute.shtml#1ScriptAnchor_)
- [SQL to other databases/Microsoft SQL Server Connect](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/Microsoft%20SQL%20Server%20Connect.shtml#1ScriptAnchor_)
- [SQL to other databases/MySQL example](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/MySQL%20example.shtml#1ScriptAnchor_)
- [SQL to other databases/MySQL Query](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/MySQL%20Query.shtml#1ScriptAnchor_)
- [SQL to other databases/ODBC Query](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/ODBC%20Query.shtml#1ScriptAnchor_)
- [SQL to other databases/ODBC to FIleMaker/ODBC Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/ODBC%20to%20FIleMaker/ODBC%20Test.shtml#1ScriptAnchor_)
- [SQL to other databases/PostgreSQL Query](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/PostgreSQL%20Query.shtml#1ScriptAnchor_)
- [SQL to other databases/SQL Export](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/SQL%20Export.shtml#1ScriptAnchor_)

### Blog Entries

- [Connect to DuckDB in FileMaker](https://www.mbsplugins.de/archive/2025-04-10/Connect_to_DuckDB_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Connect to Postgres in FileMaker](https://www.mbsplugins.de/archive/2025-04-09/Connect_to_Postgres_in_FileMak/monkeybreadsoftware_blog_filemaker)
- [Moving data from ODBC to FileMaker via script](https://www.mbsplugins.de/archive/2023-02-12/Moving_data_from_ODBC_to_FileM/monkeybreadsoftware_blog_filemaker)
- [Transactions with SQL functions](https://www.mbsplugins.de/archive/2022-04-28/Transactions_with_SQL_function/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.3pr7](https://www.mbsplugins.de/archive/2019-07-21/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [Tip of the day: Connect to MySQL and run a query](https://www.mbsplugins.de/archive/2017-02-07/Tip_of_the_day_Connect_to_MySQ/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 1/2016, Seite 30](https://filemaker-magazin.de/neuigkeit/3870-Appetithappen-FMM_201601)
- [Ausgabe 4/2015, Seite 16](https://filemaker-magazin.de/neuigkeit/3822-Appetithappen-FMM_201504)

This function is free to use.

Created 18th August 2014 , last changed 7th December 2015

  
[SQL.FreeAllConnections](SQLFreeAllConnections.md) - [SQL.FreeConnection](SQLFreeConnection.md)

[HTML Version](SQLFreeCommand.shtml)