Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Posts
    1

    Unanswered: Query behaviour ??

    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?

    Rgds

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    The 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".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •