# Delete specific history for tag

**URL:** <https://forum.inductiveautomation.com/t/delete-specific-history-for-tag/18557>\
**Category:** Ignition\
**Created:** [June 21, 2018, 1:30pm UTC](https://forum.inductiveautomation.com/t/delete-specific-history-for-tag/18557 "2018-06-21T13:30:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 21, 2018, 1:30pm UTC](https://forum.inductiveautomation.com/t/delete-specific-history-for-tag/18557/1 "2018-06-21T13:30:43Z")

</div>

Hi,

I’m trying to make a tag history utility in Ignition to do a number of things, one of which is to copy history for tagA for a date range into another tagB. The problem is, tagB may already have its own tag history within the date range, so I need to delete this first before copying in the tagA data.

I could try to form a DELETE query, but the history could span multiple historic tables whose names I’m not sure how to construct… one example name **is sqlt\_data\_3\_2018\_06** which is the history table for this current month (current date: 2018-06-21). Where does the ‘3’ come from and can i predict this name?

What’s the best way to do this?

Cheers,  
Nick

---

<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 21, 2018, 2:48pm UTC](https://forum.inductiveautomation.com/t/delete-specific-history-for-tag/18557/2 "2018-06-21T14:48:04Z")

</div>

The `3` is the driver id, which comes from `sqlth_drv`, specifically whichever record for a given gateway name has ‘null’ for a realtime provider. See [this page](https://docs.inductiveautomation.com/display/SE/Tag+History+Tables+Reference) for a general reference on the historian’s table structure.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 3, 2018, 8:38am UTC](https://forum.inductiveautomation.com/t/delete-specific-history-for-tag/18557/3 "2018-07-03T08:38:17Z")

</div>

Thanks Paul, I got this part working. The import side has lots of issues still when run over more than a day’s worth of data, with many samples are being missed… I presume it’s the sampling method i’m using. All in the fun!

---

<div class="post-metadata">

**Author:** ![Remo\_Aerts](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@Remo\_Aerts](https://forum.inductiveautomation.com/u/Remo_Aerts)\
**Post date:** [June 23, 2023, 10:30am UTC](https://forum.inductiveautomation.com/t/delete-specific-history-for-tag/18557/4 "2023-06-23T10:30:09Z")

</div>

hey

i now this is posted a long time ago. but have you ever got this working?  
i did try to do somying similar (tag historian from one to another database) but this started to do strange tings.

now i am trying to make a delete taghistory and safe it into a file. and a file insert to database function.

do you still now if you did get errors when dowing this?
