03 Aug 2018
This is a short post to demonstrate a simple way to pass an array of data to a stored procedure. I’ve supplied some C# to use it too.
Firstly, create a custom table type in SQL. Note that you only need to do this step once per database.
Update your stored procedure to accept a parameter of the new type.
In C# build the table like this.
Add it as a command parameter like so…
Finally, use the array in your stored procedure like this.