Convert Function

  • Good Morning Everyone,

    I have stored salary amount as varchar in my table and now i need to convert into currency format with "$" sign.  I have wrote following funciton to convert the datatype

    '$'+ Convert(varchar,Convert(money,Salary),1)

    This converts 50000 into $50,000.00

    Now i need to get rid of decimals at the end so that $50,000.00 will display as $50,000

    What function do i need to use to get rid of decimals ?

     

    Thanks

  • Firstly, why are you storing it as a number? Why not store it the correct way and format ini the end app???

    Why store it as a string?

     

    If you must...

    SELECT

    left('$50,000,000.00', Len('$50,000,000.00')-3)

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • i agree why don't you format it in the front end

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply