# Time QueryTag

**URL:** <https://forum.inductiveautomation.com/t/time-querytag/6234>\
**Category:** Ignition\
**Created:** [April 16, 2013, 2:49am UTC](https://forum.inductiveautomation.com/t/time-querytag/6234 "2013-04-16T02:49:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CPowell](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@CPowell](https://forum.inductiveautomation.com/u/CPowell)\
**Post date:** [April 16, 2013, 2:49am UTC](https://forum.inductiveautomation.com/t/time-querytag/6234/1 "2013-04-16T02:49:15Z")

</div>

I have created a Querytag to access my SQL database.

Tag name = Time.  
Data Type = DateTime  
Scan Class runs every second.

SQL Query is:

```auto
SELECT SYSUTCDATETIME()
```

In the Database Query Browser, it gives me the UTC time in 0.034 secs.  
I have tried this with 4 different databases. Remote / Local.  
Works perfect.

But the tag runs fast… I mean seconds are sometimes milliseconds.  
It gets up to 4 hours fast, then bounces to near the correct time.  
Query load is 1.2 queries/sec.

Ignition version: 7.5.6(b1317)  
Java version: 1.7.0\_17

Any ideas??  
Chris

---

<div class="post-metadata">

**Author:** ![dave.fogle](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dave.fogle](https://forum.inductiveautomation.com/u/dave.fogle)\
**Post date:** [April 22, 2013, 11:15pm UTC](https://forum.inductiveautomation.com/t/time-querytag/6234/2 "2013-04-22T23:15:25Z")

</div>

How long does it take before the tag starts to run fast? I tested this with MySQL using the SYSDATE (granted not getting ms precision) function and a SQLTag in a 250ms scanclass and it stayed synced up for the 5 or 10 minutes I was running the test.

---

<div class="post-metadata">

**Author:** ![CPowell](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@CPowell](https://forum.inductiveautomation.com/u/CPowell)\
**Post date:** [April 22, 2013, 11:48pm UTC](https://forum.inductiveautomation.com/t/time-querytag/6234/3 "2013-04-22T23:48:56Z")

</div>

It happens immediately.  
I am using MSSQL.

I changed the tag type to a string and it works. I did have it as a DateTime.  
That must have been the issue.

Cheers,  
Chris
