# SQLHistorian tag data

**URL:** <https://forum.inductiveautomation.com/t/sqlhistorian-tag-data/8468>\
**Category:** Ignition\
**Created:** [May 19, 2014, 3:47pm UTC](https://forum.inductiveautomation.com/t/sqlhistorian-tag-data/8468 "2014-05-19T15:47:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clkman](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@Clkman](https://forum.inductiveautomation.com/u/Clkman)\
**Post date:** [May 19, 2014, 3:47pm UTC](https://forum.inductiveautomation.com/t/sqlhistorian-tag-data/8468/1 "2014-05-19T15:47:06Z")

</div>

Hi,

I was wondering if it would be possible to export the data contained within an historian tag to an standard SQL table.

Any pointers or advice would be gratefull. 😃

---

<div class="post-metadata">

**Author:** ![Dravik](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@Dravik](https://forum.inductiveautomation.com/u/Dravik)\
**Post date:** [May 19, 2014, 4:47pm UTC](https://forum.inductiveautomation.com/t/sqlhistorian-tag-data/8468/2 "2014-05-19T16:47:39Z")

</div>

Maybe use system.tag.queryTagHistory to export to a dataset?  
Then take that dataset out to anything you wanted.

---

<div class="post-metadata">

**Author:** ![anna](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anna](https://forum.inductiveautomation.com/u/anna)\
**Post date:** [May 19, 2014, 5:13pm UTC](https://forum.inductiveautomation.com/t/sqlhistorian-tag-data/8468/3 "2014-05-19T17:13:19Z")

</div>

Clkman what exactly do you mean by exporting “the data contained within an historian tag”? Are you trying to grab tag history data contained in Ignition Historian sqlt\_data\_\* tables?

Yes, system.tag.queryTagHistory will work, or you could use a Table component with Tag History binding and then work with its dataset. In either case, you will then want to iterate through the resulting dataset and insert the rows into your database table.

On another note, you can also log tag history in Ignition with a transaction group, which will create a “standard” SQL table (with a t\_stamp column followed by data columns). The second half of [http://www.inductiveautomation.com/support/usermanuals/ignition/index.html?how\_do\_i\_log\_history\_for\_a\_tag.htm](http://www.inductiveautomation.com/support/usermanuals/ignition/index.html?how_do_i_log_history_for_a_tag.htm)user manual page describes just that.
