SQL Server money precision must be 4
See original GitHub issue- Python: 3.7.0
- pyodbc: 4.0.24
- OS: Linux
- DB: Microsoft SQL Server 2008 R2 (SP3) - 10.50.6220.0 (X64)
- driver: FreeTDS
db = pyodbc.connect(my_connection_string)
sql = 'SELECT CAST(0.1234 AS money)'
print(db.execute(sql).fetchall()[0])
# outputs (Decimal('0.12'), )
# expected (Decimal('0.1234'), )
All MSSQL versions should have 4-digits precision for money type
Is this configurable maybe? Thank you!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Should you choose the MONEY or DECIMAL(x,y) datatypes in ...
I'm aware that money is specific to SQL Server. I want to know if there is a compelling reason to choose one over...
Read more >Precision, scale, and length (Transact-SQL) - Microsoft Learn
In SQL Server, the default maximum precision of numeric and ... For example, an int data type can hold 10 digits, is stored...
Read more >Avoid use of the MONEY and SMALLMONEY datatypes (BP022)
Use of the MONEY and SMALLMONEY datatypes can lead to unintentional loss of precision, due to rounding errors, during calculations.
Read more >SQL Money Data Type: What Is It? What About Decimal?
The MONEY data type in SQL Server is shrouded in mystery. What is it for? When should you avoid it? What advantages does...
Read more >What is the difference between Decimal (19, 4) and Money ...
I suggested that,we should consider using DECIMAL (19, 4). ... is the difference between Decimal (19, 4) and Money Data type in SQL...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh my, hope it’s in the right place now )
This is fault of ODBC driver, not pyODBC. pyODBC is asking driver to return result in character format and driver is returning character string “0.12” which has truncated the precision already.