Table-valued parameters is a feature introduced in SQL Server 2008. In earlier versions of SQL Server it was not possible to pass a table variable into a stored procedure as a parameter.
In SQL SERVER 2008 we can use table-valued parameters to send multiple rows of data to a stored procedure or a function without creating a temporary table or passing in multiple parameters. Table-valued parameters are declared using user-defined table types. To use a table-valued Parameter we need to follow the steps shown below:
- Create a table type and define the table structure.
- Declare a stored procedure that has a parameter of table type.
- Declare a table type variable and reference the table type.
- Populate the variable using the INSERT statement.
- We can now pass the variable to the procedure.
Thanks for reading this article,
Next steps :
- Share this with your colleagues because Sharing is Learning
- Comment below if you need any assistance
Powered by CodeReview – Let’s make it Better!