# Using CurrentDateTime to execute a stored procedure

**URL:** <https://forum.inductiveautomation.com/t/using-currentdatetime-to-execute-a-stored-procedure/3038>\
**Category:** Ignition\
**Created:** [June 27, 2011, 9:03pm UTC](https://forum.inductiveautomation.com/t/using-currentdatetime-to-execute-a-stored-procedure/3038 "2011-06-27T21:03:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![walrusmstr](https://avatars.discourse-cdn.com/v4/letter/w/9dc877/32.png) [@walrusmstr](https://forum.inductiveautomation.com/u/walrusmstr)\
**Post date:** [June 27, 2011, 9:03pm UTC](https://forum.inductiveautomation.com/t/using-currentdatetime-to-execute-a-stored-procedure/3038/1 "2011-06-27T21:03:19Z")

</div>

I am currently trying to use a stored procedure to report data at 6:00am every day. Aside from waiting until 6:00am and enabling the stored procedure to execute each day I am wondering if it’s possible to create a tag whose value changes to ‘1’ each time the server clock reads “06:00:00”.

Thank you for your time.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [June 27, 2011, 9:51pm UTC](https://forum.inductiveautomation.com/t/using-currentdatetime-to-execute-a-stored-procedure/3038/2 "2011-06-27T21:51:44Z")

</div>

Yes, you can create a DB SQLTag that is an expression. In the SQLTags Browser right click and select New Tag \> DB Tag… There give the tag a name and boolean datatype in this case. Select the Expression / SQL tab on the left and choose Expression. Enter the following expression and press OK:`dateFormat(now(0), "HH:mm:ss") = "06:00:00"`Make sure the Scan Class associated with the new DB tag runs at least every second. If it runs slower than a second you can miss second 0 in your case. You may want to remove the seconds altogether in the expression.

---

<div class="post-metadata">

**Author:** ![walrusmstr](https://avatars.discourse-cdn.com/v4/letter/w/9dc877/32.png) [@walrusmstr](https://forum.inductiveautomation.com/u/walrusmstr)\
**Post date:** [June 28, 2011, 12:06am UTC](https://forum.inductiveautomation.com/t/using-currentdatetime-to-execute-a-stored-procedure/3038/3 "2011-06-28T00:06:19Z")

</div>

That expression seems to work. Thank you very much for your help.
