Problem to store hystorical tag

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

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)

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

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?

1 Like

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

image

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.

1 Like

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.

I resolved the issue: I restart Ignition Gateway and re-created table sqlth_te.

Thank you at all.

Bye

1 Like