# Error The coversion from UNKNOWN to UNKNOWN is unsupported

**URL:** <https://forum.inductiveautomation.com/t/error-the-coversion-from-unknown-to-unknown-is-unsupported/52626>\
**Category:** Ignition\
**Tags:** ignition80, database, vision, scripting\
**Created:** [November 2, 2021, 3:07pm UTC](https://forum.inductiveautomation.com/t/error-the-coversion-from-unknown-to-unknown-is-unsupported/52626 "2021-11-02T15:07:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonio.sanchez](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@antonio.sanchez](https://forum.inductiveautomation.com/u/antonio.sanchez)\
**Post date:** [November 2, 2021, 3:07pm UTC](https://forum.inductiveautomation.com/t/error-the-coversion-from-unknown-to-unknown-is-unsupported/52626/1 "2021-11-02T15:07:52Z")

</div>

hello

I have the following problem with a script.

| | caused by Exception: Error executing system.db.runPrepUpdate(INSERT INTO PAROS (Linea, Maquina, TipoParo, TiempoParo, Fecha) VALUES (?, ?, ?, ?, ?), [Linea\_ED, [57, Good, Thu Oct 21 05:44:28 CDT 2021], [4, Good, Thu Oct 21 05:44:28 CDT 2021], [11, Good, Tue Nov 02 08:18:59 CST 2021], Tue Nov 02 08:19:01 CST 2021], TOPY\_MW, , false, false) |
| --- | --- |
| | caused by GatewayException: SQL error for INSERT INTO PAROS (Linea, Maquina, TipoParo, TiempoParo, Fecha) VALUES (?, ?, ?, ?, ?): The conversion from UNKNOWN to UNKNOWN is unsupported. |
| | caused by SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported. |

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/6/669b797a23b2084afa5a0389f95d3f458e987ea3.png)

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

the variable called “TiempoParo” I get it from a Tag of type datetime since in my sql table it is of type time.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 2, 2021, 3:30pm UTC](https://forum.inductiveautomation.com/t/error-the-coversion-from-unknown-to-unknown-is-unsupported/52626/2 "2021-11-02T15:30:09Z")

</div>

It looks like you are reading the tags then trying to insert their values into the database. Tag reads are fully qualified meaning a read will return the tag value state, the time stamp, and the value. To get just the value you would need something like

```auto
tags = ['tag1','tag2']
results = system.tag.readBlocking(tags)
tagValueOne = results[0].value
tagValueTwo = results[1].value

```

---

<div class="post-metadata">

**Author:** ![antonio.sanchez](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@antonio.sanchez](https://forum.inductiveautomation.com/u/antonio.sanchez)\
**Post date:** [November 2, 2021, 6:22pm UTC](https://forum.inductiveautomation.com/t/error-the-coversion-from-unknown-to-unknown-is-unsupported/52626/3 "2021-11-02T18:22:05Z")

</div>

I think it’s because of the type of data I want to store because in my database time.

I have already made some modifications in the code but now I have another problem.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/5/c55fba98ef1e1eea0be14d1349cfb421b614016e.png)

```auto
INS = "INSERT INTO PAROS (Linea, Maquina, TipoParo, TiempoParo, Fecha) VALUES (?, ?, ?, ?, ?)"
Maquina = system.tag.read("Botones/Linea_ED/Conteo Falla ED/Maquina")
Tipo = system.tag.read("Botones/Linea_ED/Conteo Falla ED/Tipo_Falla")

Tiempo = system.tag.read("OEE/LINEA_ED/captura manual ED").value

Contador = system.date.midnight(system.date.now())
print "Contador=", Contador
Contador = system.date.addMinutes(Contador, Tiempo)
print "Contador=", Contador 
Contador = system.date.format(Contador, "HH:mm:ss")
print "Contador=", Contador
system.util.getLogger("TimeContador").info(str(Contador))

Fecha = system.date.now()
VAL = ['Linea_ED', Maquina.value, Tipo.value, Contador.value, Fecha]
system.db.runPrepUpdate(INS,VAL,"TOPY_MW")

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 2, 2021, 6:31pm UTC](https://forum.inductiveautomation.com/t/error-the-coversion-from-unknown-to-unknown-is-unsupported/52626/4 "2021-11-02T18:31:43Z")

</div>

The error message is telling you exactly what the problem is, the second arg isn’t an integer. This should be referring to this line

```auto
Contador = system.date.addMinutes(Contador, Tiempo)

```

I bet if you print the type it will be a string.

```auto
print type(Tiempo)

```

Change the tag type to integer, if possible, or cast the read value

```auto
int(Tiempo)

```
