format change

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

I want to display the records of myBalance column( which is a numeric field) in the format like 1000 to $1,000 10350 to $10,350 125750 to $1,25,750 etc....

-- Anonymous, April 24, 2001

Answers

Arun,

Try using the convert function, like so:

declare @money money

set @money = 12345.678952

select '$' + convert (varchar, @money, 1)

Which displays:

$12,345.68

If you really don't want the decimal point and the cents, you can remove them using the substring function.

Hope this helps,

Eric

-- Anonymous, April 27, 2001


Moderation questions? read the FAQ