DEV Community

loading...

SQL Server Table Valued Parameters with .NET

Joe Enos
Software developer/architect, mostly working with .NET and SQL Server.
・1 min read

Table valued parameters in SQL Server give you the ability to pass in multiple values in a table that can be directly queried inside the procedure or prepared statement. This can be useful for passing in collections of simple values, multi record inserts, or for many other reasons.

.NET gives you a couple different options, like most things in ADO.NET - you can use type-safe objects with a little extra work, or you can use a simple DataTable.

Here's an example showing both ways.

Discussion (0)