Hey folks, I’m trying to figure out if there’s any real difference between using money
and decimal(19,4)
in SQL Server. I know money
is SQL Server specific, but I’m wondering if there’s a good reason to pick one over the other.
I’ve noticed that a lot of SQL Server examples, like the AdventureWorks database, use money
for prices and stuff. But is that the best way to go?
Should I stick with money
, or is decimal
better for some reason? I know money
is shorter to type, but that’s not a good enough reason on its own.
Anyone have experience with this? What do you use in your projects and why? Thanks for any advice!
hmm, interesting question! i’m curious, have you looked into performance? they say money might be faster, but what about integrity across systems? is portability important in your project? would love to hear more abt your specific financial data needs.
yo, i’ve used both. honestly, decimal(19,4) is probs better. money’s ok for quick stuff, but decimal gives u more control. plus, it works everywhere. money’s kinda stuck to sql server. in my projects, i always go decimal. it’s just more flexible, ya know?
In my experience, DECIMAL(x,y) is generally the better choice for financial data in SQL Server. While MONEY might seem convenient, it has limitations that can cause issues down the line.
DECIMAL offers more precision and flexibility. You can adjust the scale and precision as needed, which is crucial for different financial calculations. It’s also more widely supported across different database systems, making potential migrations easier.
MONEY, on the other hand, is fixed at 4 decimal places and can lead to rounding errors in complex calculations. It’s also SQL Server-specific, which can be problematic if you ever need to switch platforms.
I’ve worked on several financial systems, and we always opted for DECIMAL. It provided better accuracy and more control over our data representation. While MONEY might be fine for simple applications, DECIMAL is the safer, more versatile choice for serious financial work.