Skip to main content
Roberty Studio
RPASQL Server

SQL Server - Query

SQL Server - Query

Runs a SQL statement on a SQL Server database. It supports SELECT, INSERT, UPDATE, DELETE and other standard SQL statements. The results can be iterated with SQL Server: For each result or read directly from the action returns.


Options​

Connection​

Reference to the SQL Server: Connection action that will be used to run the query.

Query to be executed​

SQL statement to run on the SQL Server database, for example SELECT * FROM dbo.Clientes WHERE Ativo = 1.

Advanced options​

Transaction​

Option to select a previously created transaction to be used together with this query's execution.

Query timeout​

Maximum time, in seconds, this query may run. When empty, the Default query timeout set on the SQL Server: Connection applies. A value of 0 means no limit. When the limit is reached, the action fails; the connection's Time limits section describes what happens to the query and the connection. Optional field.

Returns​

Javascript code​

js
actions["action-id"].query // query that was executed (Text)
actions["action-id"].results // query results (Any)
actions["action-id"].resultsCount // number of records returned (Number)

Field selection​

  • query — query that was executed (Text)
  • results — query results (Any)
  • resultsCount — number of records returned (Number)

Rules and Conditions​

  • The Connection and Query fields are required.
  • results and resultsCount are relevant for SELECT statements.
  • For INSERT, UPDATE or DELETE statements, resultsCount returns 0.
  • The Query timeout field is optional and its value is in seconds; 0 means no limit.
  • When Query timeout is empty, the connection's default query timeout applies.
  • If no field of the Time limits group is filled in on the connection, the query is still limited to 15 seconds (or to the connection string's Request Timeout), even if Query timeout is longer than that or 0.