Friday, January 29, 2010

Formatting as Currency

If you need to format a number as currency, do this:

declare @d money set @d=50000.52
select '$' + convert(varchar(50), @d,1)

Result: $50,000.52

Though it should be noted that usually, formatting is a front-end task, and should not to be relegated to the database as a matter of best practice.

No comments: