Azure / Azure/azure-functions-sql-extension
"Error converting data type nvarchar to decimal." when serializing with 5 or more leading zeros as 1e-5
- Dominant language
- C#
- Stars
- 130
- Forks
- 71
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 4
Description
- 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.
Contributor guide
Research direction
Reproduce the local function output-binding failure with SQL Server 2022 using a decimal such as 0.00001. Trace the serialization and SQL output-binding path to confirm how the value is represented, then verify that decimals with five or more leading zeros are stored without the nvarchar-to-decimal conversion error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, sql
- Domain
- backend, cloud, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100