如何在 SQL Server 2012 中传递用户定义数据类型的值
How to pass Value of user defined datatype in SQL Server 2012
我在 sql 服务器中创建了一个用户定义的数据类型,如下所示。
CREATE TYPE MonthFees AS TABLE
(
MonthID INT, MonthName VARCHAR(20)
)
我为该数据类型创建了一个参数,如图所示,
@MinthFeeDetails MonthFees READONLY
现在我不知道如何从 sql management studio 传递该参数的值。
/* Declare a variable that references the type. */
DECLARE @mf AS MonthFees;
/* Add data to the table variable. */
INSERT INTO @mf (MonthID, MonthName)
SELECT MonthID, MonthName
FROM table_name;
/* Pass the table variable data to a stored procedure. */
EXEC usp_myprocedure @mf;
我在 sql 服务器中创建了一个用户定义的数据类型,如下所示。
CREATE TYPE MonthFees AS TABLE
(
MonthID INT, MonthName VARCHAR(20)
)
我为该数据类型创建了一个参数,如图所示,
@MinthFeeDetails MonthFees READONLY
现在我不知道如何从 sql management studio 传递该参数的值。
/* Declare a variable that references the type. */
DECLARE @mf AS MonthFees;
/* Add data to the table variable. */
INSERT INTO @mf (MonthID, MonthName)
SELECT MonthID, MonthName
FROM table_name;
/* Pass the table variable data to a stored procedure. */
EXEC usp_myprocedure @mf;