Skip to content

sqlsrv omits leading zeros for decimal/float values #881

@Jeeppler

Description

@Jeeppler

PHP Driver version or file name

sqlsrv 5.3.0 PECL

SQL Server version

SQL Server 2016 Standard

Client operating system

Ubuntu LTS 18.04

PHP version

PHP 7.2 - From official Ubuntu 18.04 repositories

Microsoft ODBC Driver version

msodbcsql17/bionic,now 17.2.0.1-1 amd64 (MD5sum: 0a13d93b2af7a0383f93d71448feb0a4)

Problem description

We upgraded from the deprecated mssql PHP driver to sqlsrv. Our application is written in PHP + Symfony and uses Doctrine to communicate to SQL Server. The platform we are on is Ubuntu 18.04 (after upgrading). Everything works, except for zero decimal/float values. The issue is that the sqlsrv driver omits leading zeros. Values which are in the dabase 0.00 will be fetched as .00.

Actual behavior

sqlsrv driver omits leading zeros in front of decimal/float values.

For example:

  • In the database: 0.00.
  • After retrieving the value: .00 in PHP application.

Expected behavior

sqlsrv driver does not omit leading zeros.

Float/decimal values should be returned with leading zeros.

For example:

  • In the database: 0.00.
  • After retrieving the value: 0.00 in PHP application.

Related

Driver omitting leading zero in decimal

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions