Skip to content

Insert failing for columns having zero value #28

@archit4077sh

Description

@archit4077sh

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 = .

tds/num.go

Line 202 in 1a2d89f

return []byte(num.String()), err

On further debugging into num.String() function, we found that the following IsInt() check is getting failed:

tds/num.go

Line 116 in 1a2d89f

if n.r.IsInt() {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions