Currency formatting

  • Is there a way to format a money value into a standard currency string with commas & dollar sign?

    Kurt

  • There's probably a really elegant way of doing this. This isn't it, but it works 

    select '$' + convert(varchar(30), cast(amount as money),1) as Formatted_Cash ...

    replacing 'amount' with the field you want to format.

     

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Thanks that works great.

  • Why don't you use your front-end for such formatting stuff? That shouldn't be the job for the server.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • The front end shoud not always be used for formatting.  If you are using ADO.NET datasets and connecting them directly to an ASP.NET DataGrid, you don't want to have to edit the dataset.  Such a formatting statement in a stored procedure is much more efficient.


    Fred Peters

Viewing 5 posts - 1 through 4 (of 4 total)

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