SQL.GetParamAsNumber
--------------------

Returns param's value as integer; converts if needed.

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

MBS( "SQL.GetParamAsNumber"; Command; Param ) 

**MBS**( **"SQL.GetParamAsNumber";** /\* Returns param's value as integer; converts if needed. \*/  
**$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" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| 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" |

### Result

Returns the value or error message.

### Description

Returns param's value as integer; converts if needed.  
For float values, you can use [SQL.GetParamAsFloat](SQLGetParamAsFloat.md).  
  
see also:  
[https://www.sqlapi.com/ApiDoc/class\_s\_a\_param.html](https://www.sqlapi.com/ApiDoc/class_s_a_param.html)  
  
Improved for MBS Plugin version 12.0 to work for all number types and preserve numeric values.  
### Examples

Query value of first parameter:

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

- [SQL.Execute](SQLExecute.md)
- [SQL.GetFieldAsNumber](SQLGetFieldAsNumber.md)
- [SQL.GetParamAsDate](SQLGetParamAsDate.md)
- [SQL.GetParamAsFloat](SQLGetParamAsFloat.md)
- [SQL.GetParamAsTime](SQLGetParamAsTime.md)
- [SQL.GetParamIsNull](SQLGetParamIsNull.md)
- [SQL.NewCommand](SQLNewCommand.md)
- [SQL.SetParamAsNumber](SQLSetParamAsNumber.md)
- [SQL.SetParamAsTime](SQLSetParamAsTime.md)

### Release notes

- **Version 12.0**
    - Added [SQL.GetFieldAsNumber](https://www.mbsplugins.eu/SQLGetFieldAsNumber.shtml), [SQL.GetParamAsNumber](https://www.mbsplugins.eu/SQLGetParamAsNumber.shtml) and [SQL.SetParamAsNumber](https://www.mbsplugins.eu/SQLSetParamAsNumber.shtml) to better handle numeric values.
- **Version 7.3**
    - Changed [SQL.GetFieldAsNumber](http://www.mbsplugins.eu/SQLGetFieldAsNumber.shtml) and [SQL.GetParamAsNumber](http://www.mbsplugins.eu/SQLGetParamAsNumber.shtml) to return numbers outside 32-bit integer as text.

### Blog Entries

- [MBS FileMaker Plugin, version 11.6pr1](https://www.mbsplugins.de/archive/2021-12-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.3pr5](https://www.mbsplugins.de/archive/2017-07-10/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.3pr1](https://www.mbsplugins.de/archive/2017-06-05/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 16th November 2021

  
[SQL.GetParamAsJPEG](SQLGetParamAsJPEG.md) - [SQL.GetParamAsPDF](SQLGetParamAsPDF.md)

[HTML Version](SQLGetParamAsNumber.shtml)