Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pass an "array" of values to my stored procedure?

Tags:

People also ask

Can we pass array in stored procedure?

Current version of Microsoft SQL Server does not have any support of array datatype that would allow passing array of values as a parameter of the stored procedure or SQL statement. Often developers are required to pass an array of the values to select records based on a provided list in an IN clause.

How do I pass a list of values to a stored procedure in SQL Server?

There are several ways to do this. While using older versions of SQL Server, I've used to the XML method to pass array or list to stored procedure. In the latest versions of SQL Server, we can use the User Defined Data Type (UDT) with a base type of table to send array or list through a parameter.

Can we pass array to stored procedure in MySQL?

We need to create a stored procedure to display how to pass array to MySQL stored routine. Let us first create a table for our example. Inserting some records into the table. To display all records.

How do you pass data into a stored procedure?

There are two ways to pass parameters to a stored procedure using SQLExec. One way, which works across all versions of Visual FoxPro, is to build the SQL command as a string variable. The advantage of this method is that you can check the string and see exactly which SQL command you are passing to the back end.


I want to be able to pass an "array" of values to my stored procedure, instead of calling "Add value" procedure serially.

Can anyone suggest a way to do it? am I missing something here?

Edit: I will be using PostgreSQL / MySQL, I haven't decided yet.