SELECT CAST(432.900010347366 AS DEC(9,2))
When you try to do that on a float that is too big to fit in a DECIMAL (9, 2) number you get an error
SELECT CAST(987654321.123456789 AS DEC(9,2))
gives "Arithmetic overflow error converting numeric to data type numeric."
With kind regards . . . . . SQL Server 2000/2005/2012
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2. Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
Hey guys! Thanks for your answers! I appreciate it!
I tried the following before posting here and consequently receive the arithmetic overflow error! Is there a way around it?
CAST(sum(fm_gekauft*PreisStehend) AS DEC(9,4)) as waldbesitzer
And yes, I definetly need the comma instead of the point! I use excel to run reports based on the results and it seems to be a little choosy on the point! At least when you consider that it's a European version!
Do you have any idea how to solve that problem? It's driving me nuts as I already spend hours of trying different attempts!
Yes, that's the way! Superb! Is there however a way to display 12345.67 as 12345,67? I tried converting it to numeric but it also delivers a decimal point! Sorry for those dumb questions! I have to admit I am fairly new to these parts of t-sql!
Is there however a way to display 12345.67 as 12345,67?
Get your front end to do this. SQL can do it, as Jav has shown, but it is typically considered poor practice. This is no longer a decimal number - it is a string of digits with a comma in there. Have SQL return and pass a decimal, let your front end do any changes you want to prettify things.