# SQL Quarantined Data

**URL:** <https://forum.inductiveautomation.com/t/sql-quarantined-data/14610>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [June 22, 2017, 5:06pm UTC](https://forum.inductiveautomation.com/t/sql-quarantined-data/14610 "2017-06-22T17:06:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacslade](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacslade/32/3587_2.png) [@zacslade](https://forum.inductiveautomation.com/u/zacslade)\
**Post date:** [June 22, 2017, 5:06pm UTC](https://forum.inductiveautomation.com/t/sql-quarantined-data/14610/1 "2017-06-22T17:06:16Z")

</div>

Historical Data is occasionally being quarantined in my project, and I’m wondering if any of you have any ideas about where I should begin troubleshooting this…

I’m using MSSQL. The “reason” is…

```auto
Violation of PRIMARY KEY constraint 'PK __sqlt_dat__ BE126DD153A94FE8'. Cannot insert duplicate key in object 'dbo.sqlt_data_1_2017_06'. The duplicate key value is (752, 1498065282245).
```

I found the referenced entry in the database, and the value there is NULL with a dataintegrity 600. I found the entry in the quarantine export, and it does have a value and good quality associated with it.

Any thoughts?

---

<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:** [June 22, 2017, 5:42pm UTC](https://forum.inductiveautomation.com/t/sql-quarantined-data/14610/2 "2017-06-22T17:42:57Z")

</div>

Well, the timestamp for history is raw unix milliseconds, so you are encountering tags that are switching to null/bad quality and back to good in the same millisecond. History is keyed on the tag id and the timestamp, so you can’t write the good value after the bad.  
The real question is how are you getting tags to update twice in the same millisecond?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 22, 2017, 8:55pm UTC](https://forum.inductiveautomation.com/t/sql-quarantined-data/14610/3 "2017-06-22T20:55:03Z")

</div>

> [@pturmel](#):
>
> The real question is how are you getting tags to update twice in the same millisecond?

Along these lines:  
Have you ever set up a test or development gateway? Something running a (possibly old) backup of your primary system?

---

<div class="post-metadata">

**Author:** ![zacslade](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacslade/32/3587_2.png) [@zacslade](https://forum.inductiveautomation.com/u/zacslade)\
**Post date:** [June 22, 2017, 9:42pm UTC](https://forum.inductiveautomation.com/t/sql-quarantined-data/14610/4 "2017-06-22T21:42:54Z")

</div>

> [@pturmel](#):
>
> The real question is how are you getting tags to update twice in the same millisecond?

I'm not really sure how the tags are updating twice. I've been looking through the settings, but I don't see anything that might cause it.

> [@paul-griffith](#):
>
> Along these lines:Have you ever set up a test or development gateway? Something running a (possibly old) backup of your primary system?

Not exactly. However, this scada is being deployed on multiple similar sites, (so far two, but more to come), and the two current sites have the same issue.

---

<div class="post-metadata">

**Author:** ![Caleb\_Bohon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/caleb_bohon/32/3293_2.png) [@Caleb\_Bohon](https://forum.inductiveautomation.com/u/Caleb_Bohon)\
**Post date:** [June 22, 2017, 11:07pm UTC](https://forum.inductiveautomation.com/t/sql-quarantined-data/14610/5 "2017-06-22T23:07:39Z")

</div>

Are those two sites pointing to the same DB server?

If so did you use a GW backup to create the second GW?

The way Phil and Paul ask the questions, I wonder if maybe you have two GWs with the same name sending history to the same DB server.

---

<div class="post-metadata">

**Author:** ![zacslade](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacslade/32/3587_2.png) [@zacslade](https://forum.inductiveautomation.com/u/zacslade)\
**Post date:** [June 23, 2017, 1:18am UTC](https://forum.inductiveautomation.com/t/sql-quarantined-data/14610/6 "2017-06-23T01:18:28Z")

</div>

Good question, I wasn’t clear on that. The two sites have separate DBs and are on separate networks.
