Skip to content

"Error converting data type nvarchar to decimal." when serializing with 5 or more leading zeros as 1e-5 #1133

@cadcad-sat

Description

@cadcad-sat
  • Azure Functions SQL Extension or Extension Bundle Version:

    • Core Tools Version: 4.0.6517
    • RuntimeVersion: 4.1036.1.23224
    • Worker.Extensions.Sql: 3.0.534
  • Is this a deployed or local function:
    local function

  • What type of Database are you using? (Run SELECT @@VERSION as Version, SERVERPROPERTY('EngineEdition') as EngineEdition on your database)

Version EngineEdition
Microsoft SQL Server 2022 (RTM-CU15-GDR) (KB5046059) - 16.0.4150.1 (X64)
Sep 25 2024 17:34:41
Copyright (C) 2022 Microsoft
Corporation
Developer Edition (64-bit) on Linux (Ubuntu 22.04.5 LTS)
3

BUG

I encountered an error while attempting to add a decimal value as an output binding. The error message is as follows:

Exception executing query. Message=Error converting data type nvarchar to decimal.

Upon investigation, I discovered that the error occurs when the decimal value contains five or more leading zeros, such as 0.00001.
I suspect that this issue arises because the decimal value is serialized as 1e-5 in JSON, which then fails to parse correctly in SQL Server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions