How to pass a table type parameter to SQLExecute?

0

In MS SQL Server 2016 I have a table type parameter:

CREATE TYPE dbo.Ids AS TABLE (Id INTEGER NOT NULL);

and a stored procedure:

CREATE PROCEDURE dbo.TableParam  @SelectedIds dbo.Ids READONLY AS
BEGIN SELECT * FROM @SelectedIds; END

In Mathematica I have a selection of ids that I want to pass into the SQL procedure. However, I have not been able to figure out the syntax. The following does not work.

SQLExecute[conn, "dbo.TableParam `1`", {{{5}, {6}, {7}}}]

Any ideas?

Edmund

Posted 2016-07-02T21:36:36.267

Reputation: 35 657

Don't you have one pair of braces too much? – Sjoerd C. de Vries – 2016-07-03T18:23:47.230

@SjoerdC.deVries SQLExecute is expecting a list of arguments with the list of ids being the first item in the list. The real SQL procedure takes a few arguments with one of them being the table type. – Edmund – 2016-07-03T20:48:23.357

No answers