Is there a way to run stored procedures with table-valued input parameters from Matlab using the Database Toolbox?

2 views (last 30 days)
I'm currently trying to run a Stored Procedure written in SQL Server from Matlab. My problem is that I have several inputs, some of them having variable number of parameters (for example one is a table containing 3 columns and at every run different number of rows).
Running the runstoredprocedure function will not work because it only accepts values and not matrices, something like datainsert will not work either, because I have to populate a not yet existing table (type), and finally I tried to run it using the exec function, but for some reason that does not give back any result set, which is a problem also.
sqlquery1 = 'DECLARE @input TVP; DECLARE @output int;';
sqlquery2 = ['INSERT INTO @input VALUES (' val1 ',' val2 ',' val3 ');'];
sqlquery3 = 'exec dbo.sp_Name @input, @output OUTPUT;';
curs = exec(conn,[sqlquery1 sqlquery2 sqlquery3])
Running a code like this I only get the Message 'The statement did not return a result set.'
Is there a way to call something like this from Matlab? Any help would be appreciated.
Thanks.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!