Passing a Table Valued parameter to a stored procedure

前端 未结 4 451
予麋鹿
予麋鹿 2021-01-06 06:54

Here\'s an example of how to use table-valued parameters in a SQL Server 2008 stored procedure using .NET.

And here\'s the list of parameter types in CF9.

Q

4条回答
  •  清酒与你
    2021-01-06 07:14

    I discovered this workaround. You can call a stored procedure from within a cfquery, this way you can pass in a Table valued parameter TVP.

    
         DECLARE        @return_value int
    
         -- Create table value parameter
         DECLARE @DataTVP tDataTable;
    
         --Build Table
         INSERT INTO @DataTVP(DataId)
         VALUES (1),(2),(3)
    
         EXEC        @return_value = P_DeleteItems
                     @tvpData = @DataTVP --Pass table into Stored Procedure
    
         SELECT        'Return Value' = @return_value 
    
    

提交回复
热议问题