tds icon indicating copy to clipboard operation
tds copied to clipboard

Insert failing for columns having zero value

Open archit4077sh opened this issue 4 years ago • 1 comments

Code used to insert row(values are having numeric data type in database): db.Exec("INSERT INTO table_name (col_a, col_b) VALUES (?, ?)", 1.23, 0)

Error Received: tds: error while scanning array of bytes to numeric: tds: could not parse string . to number

Debugged further and found that num.String() in line below is returning value = . https://github.com/thda/tds/blob/1a2d89f5d5741816a6f3cfe7fd827399bf52fcf2/num.go#L202

On further debugging into num.String() function, we found that the following IsInt() check is getting failed: https://github.com/thda/tds/blob/1a2d89f5d5741816a6f3cfe7fd827399bf52fcf2/num.go#L116

archit4077sh avatar Oct 29 '21 21:10 archit4077sh

Thanks for the report. I'll check it tomorrow. It should be fixed shortly.

thda avatar Nov 01 '21 20:11 thda