diff --git a/src/Database/Drivers/Engines/SQLServerEngine.php b/src/Database/Drivers/Engines/SQLServerEngine.php index 6aded096e..54355d09f 100644 --- a/src/Database/Drivers/Engines/SQLServerEngine.php +++ b/src/Database/Drivers/Engines/SQLServerEngine.php @@ -227,8 +227,6 @@ public function resolveColumnConverter(array $meta, TypeConverter $converter): ? return match ($meta['nativeType']) { 'timestamp' => null, // timestamp does not mean time in sqlsrv 'bit' => $converter->convertBoolean ? $converter->toBool(...) : $converter->toInt(...), - 'decimal', 'numeric', - 'double', 'double precision', 'float', 'real', 'money', 'smallmoney' => fn($value): float => (float) (is_string($value) && str_starts_with($value, '.') ? '0' . $value : $value), default => $converter->resolve($meta['nativeType']), }; } diff --git a/src/Database/Drivers/PDO/SQLSrv/Driver.php b/src/Database/Drivers/PDO/SQLSrv/Driver.php index 7f5d856e6..b51c82b99 100644 --- a/src/Database/Drivers/PDO/SQLSrv/Driver.php +++ b/src/Database/Drivers/PDO/SQLSrv/Driver.php @@ -33,6 +33,7 @@ public function connect(): Drivers\Connection { $connection = new Drivers\PDO\Connection(self::EngineClass, ...$this->params); $connection->metaTypeKey = 'sqlsrv:decl_type'; + $connection->pdo->setAttribute(\PDO::SQLSRV_ATTR_FORMAT_DECIMALS, true); return $connection; }