Delete specific history for tag

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

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 for a general reference on the historian’s table structure.

1 Like

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!

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?