# Table variable - Type code

**URL:** <https://forum.inductiveautomation.com/t/table-variable-type-code/7829>\
**Category:** Ignition\
**Created:** [January 13, 2014, 11:59pm UTC](https://forum.inductiveautomation.com/t/table-variable-type-code/7829 "2014-01-13T23:59:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![justice5555](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@justice5555](https://forum.inductiveautomation.com/u/justice5555)\
**Post date:** [January 13, 2014, 11:59pm UTC](https://forum.inductiveautomation.com/t/table-variable-type-code/7829/1 "2014-01-13T23:59:01Z")

</div>

We have several stored procedures that utilize table variables. It would be useful if a type code existed so we can use these variables without having to re-write the stored procedure to handle multiple inputs.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [January 14, 2014, 12:10am UTC](https://forum.inductiveautomation.com/t/table-variable-type-code/7829/2 "2014-01-14T00:10:36Z")

</div>

MySQL stored procedures do not have an array/table data type that can used as an argument.

Another possible option is to convert your data into a CSV string and pass the CSV string as an argument to your stored procedures and parse the CSV string in stored procedures into variables.

---

<div class="post-metadata">

**Author:** ![justice5555](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@justice5555](https://forum.inductiveautomation.com/u/justice5555)\
**Post date:** [January 14, 2014, 2:07am UTC](https://forum.inductiveautomation.com/t/table-variable-type-code/7829/3 "2014-01-14T02:07:45Z")

</div>

Thanks for the tip nmudge. Can probably extract the columns quickly in an Ignition script as well. Just trying to save time since the stored procedures are already written.

I should have specified we are using MS SQL Server 2012.

Example:

`CREATE TYPE TableX AS TABLE 
( Name VARCHAR(50), Hours INT );
GO
CREATE PROCEDURE dbo. usp_ProcedureX
    @TableVariable TableX READONLY
    AS 
    SET NOCOUNT ON
    ...`

`...
procedure="dbo.usp_ProcedureX"
call=system.db.createSProcCall(procedure)
call.registerInParam(1, system.db.???, TableVariable)
...`

Tried system.db.ARRAY, system.db.STRUCT, system.db.OTHER, but all returned an error. IA’s Technical Support told me this mapping is not supported yet, which is why I posted as a feature request.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [January 14, 2014, 4:18pm UTC](https://forum.inductiveautomation.com/t/table-variable-type-code/7829/4 "2014-01-14T16:18:13Z")

</div>

ah, I see. Thanks.
