formatting money

Posted on 2009-12-19
Last Modified: 2012-05-08
I am trying to format a number. According the the convert() documentation:, CONVERT ( data_type [ ( length ) ] , expression [ , style ] ), for type money, style 1 should give me: "Commas every three digits to the left of the decimal point, and two digits to the right of the decimal point; for example, 3,510.92."

I have tried: convert(money,earningsAmount,1) and convert(varchar,cast(earningsAmount as money),1)

both give me e.g. 1735.3400 whereas I am looking for 1,735.34

What am I doing wrong?
Question by:jmarkfoley
    LVL 30

    Accepted Solution

    try like this:

    select convert(varchar(max),convert(money,43532423.343,1),1)

    Open in new window

    LVL 1

    Author Comment

    thanks, that did it! Amazingly complex!
    LVL 30

    Expert Comment

    by:Reza Rad
    glad to help


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
    Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now