# Named query to insert float to sql, error unable to coerce to number

**URL:** <https://forum.inductiveautomation.com/t/named-query-to-insert-float-to-sql-error-unable-to-coerce-to-number/21143>\
**Category:** Ignition\
**Created:** [November 29, 2018, 6:39pm UTC](https://forum.inductiveautomation.com/t/named-query-to-insert-float-to-sql-error-unable-to-coerce-to-number/21143 "2018-11-29T18:39:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bebel](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bebel](https://forum.inductiveautomation.com/u/bebel)\
**Post date:** [November 29, 2018, 6:39pm UTC](https://forum.inductiveautomation.com/t/named-query-to-insert-float-to-sql-error-unable-to-coerce-to-number/21143/1 "2018-11-29T18:39:03Z")

</div>

I have a named query to insert a record into a sql database table  
One of the data types in the table is float. In the Parameters portion of the named query I have tried Float4 and Float8  
In the button that triggers the named query the applicable part is  
ValueA = [tagpath]  
system.db.runNamedQuery([NamedQryName], {“Value1”:ValueA,})

The tag datatype is also set to float

When the named query is executed, I get the error: Error trying to coerce [tagpath] to a number.  
It is already a float (number).

---

<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 29, 2018, 6:46pm UTC](https://forum.inductiveautomation.com/t/named-query-to-insert-float-to-sql-error-unable-to-coerce-to-number/21143/2 "2018-11-29T18:46:49Z")

</div>

try this  
`ValueA = system.tag.read([tagpath]).value`

---

<div class="post-metadata">

**Author:** ![bebel](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bebel](https://forum.inductiveautomation.com/u/bebel)\
**Post date:** [November 29, 2018, 6:52pm UTC](https://forum.inductiveautomation.com/t/named-query-to-insert-float-to-sql-error-unable-to-coerce-to-number/21143/3 "2018-11-29T18:52:47Z")

</div>

Thank - you. That fixed it.

---

<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:** [July 11, 2019, 7:05pm UTC](https://forum.inductiveautomation.com/t/named-query-to-insert-float-to-sql-error-unable-to-coerce-to-number/21143/5 "2019-07-11T19:05:16Z")

</div>

I haven’t switched or begun to mess with Ignition 8 yet. Maybe someone else can chime in.
