# Populating Tags with Values from a Stored Procedure

**URL:** <https://forum.inductiveautomation.com/t/populating-tags-with-values-from-a-stored-procedure/10225>\
**Category:** General Discussion\
**Created:** [July 15, 2015, 1:41pm UTC](https://forum.inductiveautomation.com/t/populating-tags-with-values-from-a-stored-procedure/10225 "2015-07-15T13:41:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CJVR](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@CJVR](https://forum.inductiveautomation.com/u/CJVR)\
**Post date:** [July 15, 2015, 1:41pm UTC](https://forum.inductiveautomation.com/t/populating-tags-with-values-from-a-stored-procedure/10225/1 "2015-07-15T13:41:47Z")

</div>

I have a stored procedure that takes a parameter input and returns 10 values. I want to put these values into 10 tags. I see the following ways to do this:

1. Create 10 SQL tags and write a SQL statement that returns one value. I would have to deconstruct my SP to use only the tables and joins I need to get the one value.
2. Use a transaction group. I am not sure if this will work and I have not figured out how to pass a parameter to a stored procedure.
3. Write a script that periodically runs. I would execute the SP and then stuff the result values into the tags.

None of these seem great. Any other ideas or opinions on what is the best way to do this?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 15, 2015, 2:15pm UTC](https://forum.inductiveautomation.com/t/populating-tags-with-values-from-a-stored-procedure/10225/2 "2015-07-15T14:15:16Z")

</div>

There is a stored procedure type of transaction group specifically for this operation. Use sqltag items and specify input, output, or both for each. “Target Name” is the SP’s parameter name or index instead of a column name.

---

<div class="post-metadata">

**Author:** ![CJVR](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@CJVR](https://forum.inductiveautomation.com/u/CJVR)\
**Post date:** [July 15, 2015, 2:57pm UTC](https://forum.inductiveautomation.com/t/populating-tags-with-values-from-a-stored-procedure/10225/3 "2015-07-15T14:57:26Z")

</div>

Thanks for the info. I think I have the parameter mapping working but I am not sure how to map the output of the SP to s specific tag. In the picture below I am mapping two tags to the 2 parameters of the SP (I assume that is the Target column). Does this look correct?

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1816f3f0637bb38296a323dffa45407952053a51.png)

---

<div class="post-metadata">

**Author:** ![CJVR](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@CJVR](https://forum.inductiveautomation.com/u/CJVR)\
**Post date:** [July 15, 2015, 3:12pm UTC](https://forum.inductiveautomation.com/t/populating-tags-with-values-from-a-stored-procedure/10225/4 "2015-07-15T15:12:33Z")

</div>

I just watched the example video. I appears that a Stored Procedure Transaction Group only works with parameters. It can not handle recordsets returned by an SP. Am I correct?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 15, 2015, 5:10pm UTC](https://forum.inductiveautomation.com/t/populating-tags-with-values-from-a-stored-procedure/10225/5 "2015-07-15T17:10:08Z")

</div>

[quote=“CJVR”]It can not handle recordsets returned by an SP. Am I correct?[/quote]Correct.  
You would “Select … Into …” to put the row into your output parameters. Also, I think you had the in/out direction backwards in your image. Should look like: ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/ec995aa3137417df13d182f852fb95191b45eab7.png)
