Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Inconsistent Float Formatting Between go-sqlcmd and ODBC SQLCMD Versions

Abierto
#555 7 comentarios 1 reacción 2 asignados Ver en GitHub

@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
  1. 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
  1. 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
  1. 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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/go-sqlcmd

Todos los issues de microsoft/go-sqlcmd

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.