Skip to main content
Version: 5.6

prozeduren


description: Calling SQL Server Procedures

Stored Procedures

Stored procedures are program modules stored in the database that centrally execute recurring processes. They are suitable for encapsulating database logic, processing input parameters, and providing results or return parameters in a structured manner.

In the OPC Router, stored procedures are integrated via the generic transfer object Stored Procedures. There you will find the general properties of the transfer object as well as the OPC Router-specific features for handling input parameters, return parameters, and result sets.

Stored Procedures in Microsoft SQL Server and T-SQL

In Microsoft SQL Server, stored procedures are created and executed using Transact-SQL (T-SQL). More complex logic can also be implemented within a procedure, for example for calculations, data validation, or multi-step database operations.

Stored procedures can contain input parameters and return parameters. The OPC Router supports both variants, allowing you to pass input parameters to the procedure and process return parameters.

Additionally, the OPC Router can process result sets. In this case, the result set from the last SELECT statement executed within the procedure is used.

Example of a Stored Procedure

Example of Stored Procedures

CREATE PROCEDURE sp_myProcedure
@nMyValue INT,
@strText NVARCHAR(50) OUT
AS
BEGIN
SET @strText = 'I received ' + CAST(@nMyValue as nvarchar) + ' as value...';
END
GO

Configuration of a stored procedure in the OPC Router