简体   繁体   English

如何使用SQL Server Management studio - 用户定义表类型的“执行存储过程”?

[英]How to use SQL Server Management studio - “Execute Stored Procedure” for User Defined Table Types?

I am trying to right click a stored procedure in SQL Server Management Studio 2012 and trying to execute a stored procedure which accepts a single parameter of type tblType_XXX which is a User Defined Table Type . 我试图右键单击SQL Server Management Studio 2012中的存储过程并尝试执行一个存储过程,该存储过程接受类型为tblType_XXX的单个参数,这是一个用户定义的表类型 But when I try to pass a single value I get this error 但是当我尝试传递单个值时,我得到了这个错误

Msg 206, Level 16, State 2, Procedure uspGetXXXXXXXX, Line 0
Operand type clash: int is incompatible with tblType_XXX

How can I specify a parameter of type tblType_XXX in the SQL Server Management Studio -> Execute Stored Procedure from the UI? 如何在tblType_XXX中的SQL Server Management Studio - > 执行存储过程中指定类型为tblType_XXX的参数?

tblType_XXX only contains one column of type int tblType_XXX只包含一个int类型的列

You need to declare table variable, insert data into it if needed, call your stored procedure not using @parameter = 1 format: 您需要声明表变量,如果需要,将数据插入其中,不使用@parameter = 1格式调用存储过程:

DECLARE @return_value int,
        @tblParameter tblType_XXX

INSERT INTO @tblParameter VALUES (1)

EXEC    @return_value = [dbo].[uspGetXXXXXXXX]
        @tblParameter

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在存储过程中向SQL Server添加用户定义表类型的集合 - Adding a collection of User-Defined Table Types in a stored procedure to SQL Server SQL Server Management Studio中的存储过程依赖项 - Stored procedure dependencies in SQL Server Management Studio 当我通过应用程序执行存储过程时,SQL Server抛出超时,但是当我在Management Studio中执行存储过程时,SQL Server没有抛出超时 - SQL Server throws timeout when I execute a stored procedure through an application, but not when I execute it in the Management Studio 将用户定义的表类型与 SQL Server 中的临时存储过程一起使用 - Using a User defined table type with a temporary stored procedure in SQL Server 在SQL Server存储过程中循环用户定义的表类型 - Looping user defined table type in SQL Server stored procedure SQL Server Management Studio-了解存储过程变量 - SQL Server Management Studio - Understanding Stored Procedure variables 在SQL Server 2008 Management Studio中查找存储过程 - Finding stored procedure in SQL Server 2008 Management Studio 在 Microsoft Sql Server Management Studio 中测试存储过程 - Test a stored procedure in Microsoft Sql Server Management Studio 在 SQL Server Management Studio 中创建存储过程时出现语法错误 - Syntax error with creating a stored procedure in SQL Server Management Studio 如何在php上执行sql server存储过程? - how to execute sql server stored procedure on php?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM