# Stored Procedure Question

**URL:** <https://forum.inductiveautomation.com/t/stored-procedure-question/88237>\
**Category:** General Discussion\
**Tags:** ignition81, perspective\
**Created:** [April 2, 2024, 3:28pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237 "2024-04-02T15:28:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [April 2, 2024, 3:28pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237/1 "2024-04-02T15:28:47Z")

</div>

Good afternoon Team,

I am working on a stored procedure to "count" the time between a scan on my scanners.

When I run the SP it calls as it should showing each line individually.

I have created a query tag as well as a named query in ignition perspective. Both of these only show the count, which is 28 rows rather than all the data.

What am I doing wrong?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a906fc0017268f1ca2c000e8a20cab885a9325a8.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/5/e5ccc5efd8f90cd8338ef8c111defbee43fca234.png)

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [April 2, 2024, 4:24pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237/2 "2024-04-02T16:24:54Z")

</div>

There's no way to know without seeing your binding on the `data` property...

---

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [April 2, 2024, 4:29pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237/3 "2024-04-02T16:29:35Z")

</div>

> [@YF129701](#):
>
> ay to know without seeing your binding on the `data` property...

HEre is my tag binding on the table.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/a/0a6a42b8e6669190b23c9c7eff68a2caa168ada0.png)

Here is my query tag.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/f/af91aa8db65d54108e9b456068d111f2001af70b.png)

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [April 2, 2024, 4:58pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237/4 "2024-04-02T16:58:17Z")

</div>

Is this MySQL you're using? I'm not familiar with that GUI in your screenshot... I'm trying to figure out if it's syntax related or maybe a DB driver but it's difficult to do without knowing the vendor.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [April 2, 2024, 5:03pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237/5 "2024-04-02T17:03:47Z")

</div>

OK, so I found what I think is the issue... You need to add your DB's version of `SET NOCOUNT ON` (that's SQL Server syntax) in your procedure because if you don't , you'll return two datasets - the number of rows affected and then the data you're expecting. I found that [here](https://forum.inductiveautomation.com/t/sql-query-tag-issue/10345/3) and remembered that I myself have done this before...

---

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [April 2, 2024, 5:18pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237/6 "2024-04-02T17:18:52Z")

</div>

Great, thanks for the reply.

I am using mySQL and it does not appear to have a NOCOUNT setting. I am going to dig deeper.

---

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [April 3, 2024, 3:35pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-question/88237/7 "2024-04-03T15:35:26Z")

</div>

An update for anyone that cares.

When I created a named query for the called procedure I noticed this error.

java.sql.SQLException: Bad format for Timestamp '00:12:11.128504' in column 4.

I then went into the stored procedure and formated the date on the column to HH:MM:SS and it started working and pulled the dataset instead of the count.

Thanks for the hlep!
