What are Table Valued Parameters ?
Table-Valued Parameter is a new feature introduced in SQL SERVER. In earlier versions of SQL SERVER, it is not possible to pass a table variable in a stored procedure as a parameter, but now in SQL SERVER, we can use Table-Valued Parameter to send multiple rows of data to a stored procedure or a function without creating a temporary table or passing so many parameters.
Table-valued parameters are declared using userdefined table types. To use Table-Valued Parameters 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.
- Using the INSERT statement and occupy the variable.
- We can now pass the variable to the procedure.