Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    Posts
    39

    Unanswered: problem converting float into nvarchar

    I have a problem converting a float filed into nvarchar.
    select cast(sold as varchar(50))
    where sold=431597.15 results in 431597 and is ignoring always my decimals.
    Do you have any idea how to fix this?
    ty

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    The below works for me:
    Code:
    DECLARE @Sold AS Float
    SELECT @Sold = 431597.15
    SELECT CAST(@Sold AS VarChar(50)) --Wrong
    SELECT CAST(CAST(@Sold AS Decimal(8, 2)) AS VarChar(50))--Correct
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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