Skip to content

Developer Function: Server Script: extendedSql

Overview

Execute "Extended SQL" set in "Server Script" in the same way as "Execute Extended SQL from API".

Properties

There are no properties.

Method

Method Overview
ExecuteDataSet Execute extended SQL and get a DataSet object.
ExecuteTable Execute extended SQL and get a DataTable object.
ExecuteRow Execute extended SQL and get a DataRow object for the first row in the result set.
ExecuteScalar Execute extended SQL and get the first column of the first row in the result set.
ExecuteNonQuery Execute extended SQL. No results are received.

Usage Example

The following example calls the "Extended SQL" GetUserTop10 and logs the retrieved UserId and Name. The Extended SQL parameters are set to DepartmentID=7 and InvalidFlag=false.

JavaScript (server script)
let rows = extendedSql.ExecuteTable('GetUserTop10', '{"DeptId": 7, "Disabled": false}');
for (let row of rows){
    context.Log(row.UserId + ':' + row.Name);
}
JSON (Extended SQL Settings)
{
    "Name": "GetUserTop10",
    "Api": true
}
SQL (Extended SQL) *SQL Server
select top 10 "UserId", "Name" from "Users"
where "DeptId"=@DeptId and "Disabled"=@Disabled;