Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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 only contains one column of type int

like image 311
Rwiti Avatar asked Jul 17 '13 14:07

Rwiti


1 Answers

You need to declare table variable, insert data into it if needed, call your stored procedure not using @parameter = 1 format:

DECLARE @return_value int,
        @tblParameter tblType_XXX

INSERT INTO @tblParameter VALUES (1)

EXEC    @return_value = [dbo].[uspGetXXXXXXXX]
        @tblParameter
like image 164
Serg Avatar answered Sep 27 '22 16:09

Serg