when inserting an array with null values in string field it will Error converting data type nvarchar to numeric.

Description

Ok, I'll see what I can do. But I am almost sure what happens. Hope you can follow. (don't have to do that now, but I'll write it down. I have a string field which is NULL. I think binding is passed to getUtils.ExtractBinding
8:32
which calls inferSqlType. which calls checkIsActuallyNumeric

8:34
and there is the error. First line is: return isNull( arguments.value ) So the field will be incorrectly added as a NUMERIC.
8:35
I think I can solve this by explicitly adding a CF_SQL_VARCHAR to the field. But I will try now.
8:36
I''l let you know how you can reproduce the error.

wil-site4u 8:46 PM
yep. Problem solved by adding cfsqltype explicitly. I think you can reproduce it by creating a simple table with
id and completedBy (nullable varchar) . Create an array with at least two elements like this
[
{ id=1, completedBy={ value = "someUser", null=false }},
{ id=2, completedBy={ value = null, null=true}}
] (edited)

wil-site4u 8:53 PM
This should give an error in Lucee with full NULL support and SQL server. By adding cfsqltype = "CF_SQL_VARCHAR" problem is solved for now.

Environment

None

Assignee

Unassigned

Reporter

Wil de Bruin

Labels

None

Priority

Major
Configure