Microsoft SQL Server

Frends.MicrosoftSQL.ExecuteProcedure / 2.3.0

Summary

Calls a stored procedure with parameters, returning rows or an affected count depending on what the procedure does.

Typical use — databases where the write logic properly belongs in the database rather than in the Process

Details

Frends version
5.5 and newer
Agent
Crossplatform
Target framework
net6.0

Input parameters.

Name Type Default Example Description
ConnectionStringSecret String Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword; Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

Connection string.

Execute String ExampleProcedure

Name of stored procedure to execute. Should only contain the name of the procedure without, for example, database name or semicolons.

Parameters ProcedureParameter[] [ { Name = "id", Value = 1, DataType = SqlDataTypes.Auto }, { Name = "first_name", Value = "John", DataType = SqlDataTypes.NVarChar }, { Name = "last_name", Value = "Doe", DataType = SqlDataTypes.NVarChar } ]

Parameters for stored procedure.

ExecuteType ExecuteTypes ExecuteReader ExecuteType.ExecuteReader

Specifies how a command string is interpreted. ExecuteReader: Use this operation to execute any arbitrary SQL statements in SQL Server if you want the result set to be returned. NonQuery: Use this operation to execute any arbitrary SQL statements in SQL Server if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1. Scalar: Use this operation to execute any arbitrary SQL statements in SQL Server to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.

Possible values:

  • NonQuery: Executes a Transact-SQL statement against the connection and returns the number of rows affected.

  • Scalar: Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

  • ExecuteReader: Executes the query, and returns an object that can iterate over the entire result set.

An unhandled error has occurred. Reload 🗙