Table-Valued Parameters
As the name implies, a table-valued parameter (TVP) lets you pass an entire set of rows as a single parameter to T-SQL stored procedures and user-defined functions (UDFs). This is extremely useful in and of itself, but arguably the most compelling facet of TVPs is their ability to marshal an entire set of rows across the network, from your .NET client to your SQL Server database, with a single stored procedure call (one roundtrip) and a single table-valued parameter.
Prior to SQL Server 2008, developers were forced to resort to clever hacks in an effort to reduce multiple roundtrips into one when inserting multiple rows—using techniques such as XML, delimited or encoded text, or even (gasp) accepting hundreds (up to 2100!) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access