August 29, 2011 at 10:14 am
i have a number that i want to cast into 2 decimal places so i dont loos the precision example
select 50/100, the results shows up as 0, when in reality its is 0.2 how do i cast or convert this so i dont loose the precision...
thanks
August 29, 2011 at 10:52 am
Try this:
SELECT ( 50 * 1.00 ) / 100
And are u sure 50/100 is 0.2 ?? 😀
August 29, 2011 at 10:53 am
And this:
SELECT cast( (( 10 * 1.0 ) / 50 ) AS DECIMAL(4,2))
August 29, 2011 at 12:52 pm
take a look at this blog... this should help explain how to determine best preciscion...
http://www.sqlservercentral.com/blogs/sqlrnnr/archive/2011/8/24/precision-and-scale.aspx
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply