SQL.SetParamAsText
------------------

Sets parameter's value as character string data.

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

MBS( "SQL.SetParamAsText"; Command; Param; Value { ; Type } ) 

**MBS**( **"SQL.SetParamAsText";** /\* Sets parameter's value as character string data. \*/  
**$Command**; /\* The command reference number gained with [SQL.NewCommand](SQLNewCommand.md). \*/   
**$Param**; /\* The parameter name or ID. Pass number for ID, a text with parameter name or the index with # prefix. e.g. "#0" for first parameter.e.g. "1" \*/   
**$Value**; /\* The new valuee.g. "Hello World" \*/   
**$Type**) /\* Optional; The data type to use internally.  
Can be "Text", "CLob" or "LongChar".  
Should only be need for databases, who need the field type and data type to match exactly. e.g. Informix  
Default is text.e.g. "Text" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Command | The command reference number gained with [SQL.NewCommand](SQLNewCommand.md). | $Command |  |
| Param | The parameter name or ID. Pass number for ID, a text with parameter name or the index with # prefix. e.g. "#0" for first parameter. | "1" |  |
| Value | The new value | "Hello World" |  |
| Type | The data type to use internally.   Can be "Text", "CLob" or "LongChar".   Should only be need for databases, who need the field type and data type to match exactly. e.g. Informix   Default is text. | "Text" | Optional      Added in version **10.3**. |

### Result

Returns "OK" or error message.

### Description

Sets parameter's value as character string data.  
### Examples

Set parameter with ID = 1 to text

 MBS ("SQL.SetParamAsText"; $Command ; 1; $FirstName )  
Set parameter Lastname with text:

 MBS ("SQL.SetParamAsText"; $Command ; "Lastname"; $LastName )  
Set Param with index 0 to FirstName field:

 MBS ("SQL.SetParamAsText"; $Command ; "#0"; SQLite fun::FirstName )  
### See also

- [SQL.GetParamAsDate](SQLGetParamAsDate.md)
- [SQL.GetParamAsFloat](SQLGetParamAsFloat.md)
- [SQL.GetParamAsPNG](SQLGetParamAsPNG.md)
- [SQL.GetParamAsTime](SQLGetParamAsTime.md)
- [SQL.GetParamsAsJSON](SQLGetParamsAsJSON.md)
- [SQL.GetParamValueList](SQLGetParamValueList.md)
- [SQL.NewCommand](SQLNewCommand.md)
- [SQL.NewConnection](SQLNewConnection.md)
- [SQL.SetParamAsFloat](SQLSetParamAsFloat.md)
- [SQL.SetParamAsTime](SQLSetParamAsTime.md)

### Release notes

- **Version 10.3**
    - Added type parameter for [SQL.SetParamAsText](https://www.mbsplugins.eu/SQLSetParamAsText.shtml) function to pick text, CLob or LongChar as type.

### Example Databases

- [SQL to other databases/MySQL example](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/MySQL%20example.shtml#2ScriptAnchor_)
- [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#3ScriptAnchor_)
- [SQL to other databases/SQLite blob](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/SQLite%20blob.shtml#2ScriptAnchor_)
- [SQL to other databases/SQLite fun](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/SQLite%20fun.shtml#2ScriptAnchor_)

### Blog Entries

- [Insert and return new record ID](https://www.mbsplugins.de/archive/2024-06-27/Insert_and_return_new_record_I/monkeybreadsoftware_blog_filemaker)
- [Transactions with SQL functions](https://www.mbsplugins.de/archive/2022-04-28/Transactions_with_SQL_function/monkeybreadsoftware_blog_filemaker)
- [Connect to an external database server in FileMaker](https://www.mbsplugins.de/archive/2022-03-11/Connect_to_an_external_databas/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.3pr4](https://www.mbsplugins.de/archive/2020-06-16/MBS_FileMaker_Plugin_version_1/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 2/2022, Seite 28](https://filemaker-magazin.de/neuigkeit/4174-Appetithappen-FMM_202202)

This function is free to use.

Created 18th August 2014 , last changed 15th June 2020

  
[SQL.SetParamAsNumber](SQLSetParamAsNumber.md) - [SQL.SetParamAsTime](SQLSetParamAsTime.md)

[HTML Version](SQLSetParamAsText.shtml)