Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002
    Posts
    1

    Post Unanswered: Casting Int to Varchar

    I want to cast an In to varchar with a specific number of decimal places. So 10 will come across as 10.00.

    Is there an easy way of doing this?

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Would you be llooking for something like this?

    Code:
    --------------------------------------------------------------------------------------------------
    select cast(cast(10 as money) as varchar(10))
    select cast(cast(10 as numeric(12,4)) as varchar(10))
    --------------------------------------------------------------------------------------------------
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    I think this is what Paul was trying to show:

    select cast(cast(id as decimal(5,2)) as varchar(10)) from table

    Where id and table are defined by you. The decimal parameters would be determined by your maximum integer.

Posting Permissions

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