Need some help from you on the following query behaviour:
1).
select Round(convert(float,40000.01),2)
----------------
40000.010000000002
select convert(nvarchar(25),40000.01)
--------
40000.01
2).
select convert(nvarchar(25),Round(convert(float,40000.01) ,2))
--------
40000
Questions:
1. Why does the second query round up the result to an integer ??
2. Why does the first query insert a 2 at the 12th decimal ??
3. Why the results of the two queries are different?
RgdsThe problem is is that you are using float. Go to sql server books online and look at the article "Using decimal, float, and real Data".
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment