# Problem to store hystorical tag

**URL:** <https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [February 10, 2023, 3:41pm UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699 "2023-02-10T15:41:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [February 10, 2023, 3:41pm UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699/1 "2023-02-10T15:41:12Z")

</div>

Hi,  
when Ignition try to memorize a Tag in hystorical table, there is this error in log file:

**INFO | jvm 1 | 2023/02/10 16:31:28 | I [S.S.TagHistoryDatasourceSink] [15:31:28]: Tag history tables verified successfully. store-forward-name=Report**  
**INFO | jvm 1 | 2023/02/10 16:31:28 | E [S.S.TagHistoryDatasourceSink] [15:31:28]: Error modifying tag information in the database. store-forward-name=Report**  
**INFO | jvm 1 | 2023/02/10 16:31:28 | com.microsoft.sqlserver.jdbc.SQLServerException: Impossibile inserire il valore NULL nella colonna 'id' della tabella 'Report.dbo.sqlth\_te'. La colonna non ammette valori Null. INSERT avrà esito negativo.**  
**INFO | jvm 1 | 2023/02/10 16:31:28 | at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)**

Error is; **it's not possible insert a NULL value in the column ID in the table Report.dbo.sqlth\_te**

Why????

Thank you

Bye

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 10, 2023, 4:15pm UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699/2 "2023-02-10T16:15:54Z")

</div>

It would help to know how you are doing this and providing code if applicable.

However, I would suggest making use of the coalesce. This way you can check for a NULL value and return a default value when that happens. That should take care of your issue. Something doesn't have a value. And that is why you get this.

[coalesce - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)](https://docs.inductiveautomation.com/display/DOC81/coalesce)

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [February 10, 2023, 5:48pm UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699/3 "2023-02-10T17:48:35Z")

</div>

Hi,  
I have the problem not in script code, but when Ignition memorize a Tag in the Hstorical Table.  
It's not possible making use of coalesce.

Bye

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 10, 2023, 7:28pm UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699/4 "2023-02-10T19:28:32Z")

</div>

Make sure the tag has a value.

Null means it has no value.

Can you provide some more clarity? Ignition or Perspective? How are you populating that table?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 11, 2023, 12:45am UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699/5 "2023-02-11T00:45:22Z")

</div>

> [@stefano.sforna](#):
>
> Impossibile inserire il valore NULL nella colonna 'id' della tabella 'Report.dbo.sqlth\_te'. La colonna non ammette valori Null. INSERT avrà esito negativo.

This means that the [ID] column your SQL table cannot accept null values, presumably because it is a primary key.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e7fe3f075fdc702548220d1f3190af7fed029dbd.png)

You can change this in your MSSQL table configuration, but you probably don't want to.  
Something is passing a null ID into the query, and that is what needs to be fixed. Without more context about how the table is populated and how the dataset is passed into the INSERT query, it is impossible to guide you further than this.

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [February 11, 2023, 9:31am UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699/6 "2023-02-11T09:31:14Z")

</div>

The table is created in automatic from Ignition to memorie hystorical tag.  
In the Ignition project, I have a tag with History enabled: when tag change,in the table sqlth\_te, there is this error.

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [February 11, 2023, 10:04am UTC](https://forum.inductiveautomation.com/t/problem-to-store-hystorical-tag/69699/7 "2023-02-11T10:04:41Z")

</div>

I resolved the issue: I restart Ignition Gateway and re-created table sqlth\_te.

Thank you at all.

Bye
