Two digits after decimal point | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Two digits after decimal point

"Money" data type provides 4 digits after decimal point. I need 10 digits for integer part and only two digits as fractional part. CanadaDBA
quote:Umachandar
— This will work only for the range of values
— between those of the MONEY datatype
— See CONVERT help for other styles. declare @i int, @f decimal(8, 2)
select @i = 353532, @f = 100022.23
select convert(varchar, convert(money, @i), 1) as "Formatted Int",
convert(varchar, convert(money, @f), 1) as "Formatted Float" — Only 2 digits after decimal point
Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
But I need to define it in my table. No code change is allowed. Do you mean Decimal(12,2) will give me 10 Int and 2 fractional?… Yes, I tested and it works. Thank you! CanadaDBA
]]>