Home Forums SQL Server 2008 T-SQL (SS2K8) How to generate data in lakhs format in SQL Server 2008 RE: How to generate data in lakhs format in SQL Server 2008

  • I agree with Koen when he says that formatting should be done in the visualization layer.

    But if the column type is money, then you can use CONVERT and a format code.

    money and smallmoney Styles

    When expression is money or smallmoney, style can be one of the values shown in the following table. Other values are processed as 0.

    Value Output

    0 (default) No commas every three digits to the left of the decimal point, and two digits to the right of the decimal point; for example, 4235.98.

    1 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.

    2 No commas every three digits to the left of the decimal point, and four digits to the right of the decimal point; for example, 4235.9819.

    For example:

    SELECT CONVERT( varchar(15), MyColumn, 1)

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2