Inconsistent Float Formatting Between go-sqlcmd and ODBC SQLCMD Versions
@dlevy-msft-sql ya está trabajando en esto.
Desde el 31/1/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Description
In Windows OS the go-sqlcmd application produces a different output format for FLOAT data types compared to the ODBC-based SQLCMD.EXE when executing the same SQL query. This discrepancy can cause issues for applications and scripts that rely on consistent float formatting.
Steps to Reproduce
- Create the following table:
CREATE TABLE [dbo].[Point](
[PointId] [int] NOT NULL,
[SessionId] [int] NULL,
[Longitude] [float] NOT NULL,
[Latitude] [float] NOT NULL,
CONSTRAINT [PK_Point] PRIMARY KEY CLUSTERED
(
[PointId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT INTO [dbo].[Point] ([PointId], [SessionId], [Longitude], [Latitude]) VALUES
(1, 3, 788991.19988463481, 4713347.3103808956),
(2, 3, 789288.40771771886, 4712632.075629076),
(3, 3, 788569.36558582436, 4714608.0418091472);
GO
- Execute the following query using go-sqlcmd (version
1.8.1):
sqlCmd.exe -S serverName -d dbname -U username -P password -Q "SELECT TOP 10 * FROM dbo.Point" -s";" -W
- Execute the same query using the ODBC SQLCMD (version
15.0.4410):
sqlCmd.exe -S serverName -d dbname -U username -P password -Q "SELECT TOP 10 * FROM dbo.Point" -s";" -W
Observed Behavior
go-sqlcmd Output:
PointId;SessionId;Longitude;Latitude
-------;---------;---------;--------
1;3;788991.1998846348;4.713347310380896e+06
2;3;789288.4077177189;4.712632075629076e+06
3;3;788569.3655858244;4.714608041809147e+06
ODBC SQLCMD Output:
PointId;SessionId;Longitude;Latitude
-------;---------;---------;--------
1;3;788991.19988463481;4713347.3103808956
2;3;789288.40771771886;4712632.075629076
3;3;788569.36558582436;4714608.0418091472
Expected Behavior
The float formatting in the output of go-sqlcmd should align with the behavior of the ODBC SQLCMD to maintain compatibility and consistency across different SQLCMD implementations.
Environment
- go-sqlcmd version: 1.8.1
- ODBC sqlcmd version: 15.0.4410
- Database Server: SQL Server 2019, SQL Server 2022
- Operating System: Windows 11, Windows server
Additional Information
This issue primarily affects the formatting of float numbers. For example:
- In go-sqlcmd,
4.713347310380896e+06 - In ODBC sqlcmd,
4713347.3103808956
The scientific notation output from go-sqlcmd is less intuitive and might require additional parsing in downstream applications.
Request
Please investigate this behavior and consider aligning the float formatting of go-sqlcmd with the output of the ODBC-based SQLCMD.EXE.
- Lenguaje dominante
- Go
- Estrellas
- 595
- Forks
- 91
- Merge medio
- 9 h 35 min
- PR fusionados (30 d)
- 1
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/go-sqlcmd
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Fix CVEs in Version v1.10.0 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
":Help" command not working Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
Todos los issues de microsoft/go-sqlcmd
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
googleapis/librarian#7670 · 2 comentarios ·