> ## Documentation Index
> Fetch the complete documentation index at: https://www.integrate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ETL: ExecuteSqlString

> Execute a SQL query that returns a scalar string value. If the query returns a dataset, the value of the first column in the first row is returned.

## Description

Execute a SQL query that returns a scalar string value. If the query returns a dataset, the value of the first column in the first row is returned.

## MySQL, PostgreSQL, Microsoft SQL Server and Amazon Redshift connections:

### Syntax

`ExecuteSqlString(connection_id, sql_query[, param1] [,…paramN])`

### Arguments

*connection\_id* (string) - The unique identifier of the connection to use to execute the query. You can find it in the connection's page.

*sql\_query*  - String expression that evaluates to a query that returns a scalar value.

param1*1 ... paramN -* optional parameters to pass to the query. Use ? as placeholder in the query.

## Google BigQuery connections:

### Syntax

`ExecuteSqlString(connection_id, sql_query[, configuration_json])`

### Arguments

*connection\_id* (string) - The unique identifier of the connection to use to execute the query. You can find it in the connection's page.

*sql\_query*  - String expression that evaluates to a query that returns a scalar value.

*configuration\_json* - optional string:

```java theme={null}
{
  "useQueryCache" : boolean
 ,"useLegacySql" : boolean
}
```

* useQueryCache (optional) - boolean expression. Specifies whether to look for the result in the query cache (default value is true).
* useLegacySql (optional) - boolean expression. Specifies whether to use BigQuery's legacy SQL dialect for the query (default value is false).

## Examples

`ExecuteSqlString('mysql_55','SELECT name FROM users WHERE user_id = ?',user_id)`

`ExecuteSqlString('bq_58', 'SELECT name FROM users ORDER BY rating DESC LIMIT 1;','{"useQueryCache" : false}')`

## Notes

This function only executes in job runtime. When validating a package with variables that use the function or in X-console, the function returns null.

## Return value datatype

String

## Impact of null value

If the connection\_id or sql\_query are null, null is returned.
