April 11, 2014 at 2:32 am
Hi,
I have the following values in a Float column
266.5
280.98
127.558
How do I set the precision in a SELECT? I need to display two digits after the decimal point. My problem is the first number where I have no idea how to force to have the 0. If I try using ROUND nothing happens.
Thanks,
George
April 11, 2014 at 2:43 am
George
Have you tried CONVERTing to or CASTing as decimal?
Really, though, this is a job for the presentation layer, not the database layer. Where are you displaying the results?
John
April 11, 2014 at 2:47 am
gpascanu (4/11/2014)
Hi,I have the following values in a Float column
266.5
280.98
127.558
How do I set the precision in a SELECT? I need to display two digits after the decimal point. My problem is the first number where I have no idea how to force to have the 0. If I try using ROUND nothing happens.
Thanks,
George
I'm not quite sure what you mean there. Where do you want the 0? I read that as you only want to see the digits after the decimal point ie
0.5
0.98
0.56
I don't think that's right though.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
April 11, 2014 at 3:05 am
I am using the values in an SQL Report which I can not modify and I was expecting a number in this format XXXXXXX.XX
Thanks for the answers, actually converting it to Decimal solved the problem (CONVERT(DECIMAL(10,2), Amount) I wasn't thinking. 🙂
George
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply