declare @d decimal
i need to round it to 2.29...
Nov 10, 2010 at 12:00 AM
Nov 10, 2010 at 01:20 AM
There's 2 issues here:
you haven't defined the decimal with any precision, so by default is defined as decimal(18,0). When you asign 2.2875 to it, it essentially rounds it, giving 2
the second parameter of the round function is the number of decimal places to round to.
so your code needs to be
declare @d decimal (8,2) --for example
Nov 10, 2010 at 12:16 AM
Kev Riley ♦♦
Nov 10, 2010 at 12:17 AM
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
Need long-form SQL discussion? SQLserverCentral.com is the place.
asked: Nov 10, 2010 at 12:00 AM
Seen: 821 times
Last Updated: Nov 10, 2010 at 01:20 AM
How to convert a decimal to the nearest quarter?
Round a number to 2 decimal places
How to chop-off the decimal digits without allowing the rounding?
How do you create a non clustered index?
Table Inserts timing out
Can I call a stored procedure as part of a statement?
Use LIKE where matching pattern is a column value plus a wildcard?
Storing Greek Symbols in SQL Server 2000
Need help reorganizing db with 3000 tables!
Can the way this statement is written speed the query up or should I look at table design?