简体   繁体   中英

How do I specify parameter “output only” direction in a stored procedure in MS SQL Server 2012?

The situation: I am using Allen-Bradley (Rockwell) software package known as FactoryTalk Transaction Manager, which allows PLC's to use the power of SQL Server to do things.

Using SQL Server 2012, I need to specify the direction of parameters within the stored procedure, which I incorrectly assumed was as simple as an

@QuarantineReason nvarchar(256) OUTPUT

However when viewed in the Object Explorer of SSMS the properties for the stored procedure parameter shows

@QuarantineReason (nvarchar(256), Input/Output, No default)

In order to simplify my life greatly, I would like the parameter to be an output only, as this saves me binding the input side of things in the Allen-Bradley software.

I found several MS documentation resources online but they all seem to specify C# as the codebase, which is bewildering to me.

SqlParameter.Direction Property

Input, Output and Input/Output SqlParameter Behavior Explained

Using a Stored Procedure with Output Parameters

As far as I know, you can't do that in MSSQL, and you would have to specify the direction when calling the SP (as well as in the parameter declaration of the SP itself).

The documentation you found with C# examples is for calling an MSSQL SP from .NET C# code.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM