Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

from float to money 2

Status
Not open for further replies.

gjsaturday

Technical User
Jan 18, 2005
45
US
i have a field with datatype float. I want to display the values of this field as money (with commas every three digits to the left of the decimal point, and no digits to the right of the decimal point; for example, 3,510

i've tried CONVERT ( money, bal,1) but I get 3510.0000.

Even 3,510.00 (which I thought style 1 would give me above) would be okay.

What am I doing wrong?
 
You need to convert the float value to money first, then to varchar to add the commas:

Code:
DECLARE @num float

SET @num = 12345.678901

SELECT CONVERT(varchar, CAST(@num AS money), 1)

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top