# Deleting tag history

**URL:** <https://forum.inductiveautomation.com/t/deleting-tag-history/9832>\
**Category:** Ignition\
**Created:** [March 24, 2015, 9:21am UTC](https://forum.inductiveautomation.com/t/deleting-tag-history/9832 "2015-03-24T09:21:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serhii](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Serhii](https://forum.inductiveautomation.com/u/Serhii)\
**Post date:** [March 24, 2015, 9:21am UTC](https://forum.inductiveautomation.com/t/deleting-tag-history/9832/1 "2015-03-24T09:21:02Z")

</div>

Hi!  
Please, help.  
How to delete history data for tags which were deleted?

---

<div class="post-metadata">

**Author:** ![wdreynolds1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wdreynolds1/32/3327_2.png) [@wdreynolds1](https://forum.inductiveautomation.com/u/wdreynolds1)\
**Post date:** [March 25, 2015, 1:45am UTC](https://forum.inductiveautomation.com/t/deleting-tag-history/9832/2 "2015-03-25T01:45:37Z")

</div>

I don’t normally bother with deleting tag history for tags that were deleted. But if you want to do that, it is best to go to the sqlth\_te table first and find the id of the tag(s) you are going to delete. Then you go to your history tables ‘sqlt\_data\_…’ and run a query that looks like this…

delete from sqlt\_data\_… where tagid = [put the tag id in here]

This will delete all rows of historical data for that tag in that history partition table.

Again… this is not recommended. It is easy to make a mistake and delete history you want to keep!

Good luck!!

Walker

---

<div class="post-metadata">

**Author:** ![Serhii](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Serhii](https://forum.inductiveautomation.com/u/Serhii)\
**Post date:** [March 25, 2015, 9:16am UTC](https://forum.inductiveautomation.com/t/deleting-tag-history/9832/3 "2015-03-25T09:16:30Z")

</div>

[quote=“wdreynolds1”]I don’t normally bother with deleting tag history for tags that were deleted. But if you want to do that, it is best to go to the sqlth\_te table first and find the id of the tag(s) you are going to delete. Then you go to your history tables ‘sqlt\_data\_…’ and run a query that looks like this…

delete from sqlt\_data\_… where tagid = [put the tag id in here]

This will delete all rows of historical data for that tag in that history partition table.

Again… this is not recommended. It is easy to make a mistake and delete history you want to keep!

Good luck!!

Walker[/quote]

Thanks, will test.
