Formatting cuts numbers on SQL Server in unpredictable way

DbSchema Issues
Post Reply
Posts: 8
Joined: Thu Apr 19, 2012 2:44 pm

Formatting cuts numbers on SQL Server in unpredictable way

Post by Bergtroll » Tue Nov 01, 2016 2:51 pm

Hi there DbSchema team,

I got a problem with the display of decimal / numeric data on SQL Server. I send this SELECT statement

3.14159265359 as pi
, convert(float, 3.14159265359) AS pi_convert_float
, convert(numeric(12,5), 3.14159265359) AS pi_convert_numeric
, convert(decimal(12,5), 3.14159265359) AS pi_convert_decimal
, cast(3.14159265359 AS float) AS pi_cast_float
, cast(3.14159265359 AS numeric(12,5)) AS pi_cast_numeric
, cast(3.14159265359 AS decimal(12,5)) AS pi_cast_decimal;

What I got back is this, see how the format just cuts my numbers?:
3,14 3,1415926536 3,14 3,14 3,1415926536 3,14 3,14

When I export to CSV file instead, I get what I want, so I guess, it is a formatting problem:

How can I tell DbSchema to not do any formatting on SQL SELECT results but to show me the real deal? Or at least only cut, when the trailing digits are all 0

Best regards,
Marius Schmidt

Post Reply