Wednesday, June 28, 2006

[sql] Converting money to text

Make a money column show up as $n.nn.

select '$'+convert(varchar(10),round([MoneyColumn], 2),0) from [YourTable]

- 0 in the convert call turns it into nnnn.nn
- 1 would turn it into n,nnn.nn
- 2 would turn it into nnnn.nnnn