2016-09-18 47 views
0

我已經在sql server中創建了一個用戶定義的數據類型,如下所示。如何傳遞SQL Server 2012中用戶定義的數據類型的值

CREATE TYPE MonthFees AS TABLE 
(
    MonthID INT, MonthName VARCHAR(20) 
) 

而且我創建了該數據類型的參數,如圖所示,

@MinthFeeDetails MonthFees READONLY 

現在我不知道如何通過從SQL Management Studio中的值,該參數。

回答

1

From Documentation像這樣的事情

/* 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; 
相關問題