Reputation: 6896
I have this part of query that causes the above error:
CONVERT(varchar(15),CAST((AmountOfInsurance) as MONEY),1)
What am I doing worng?
This is the declararion of AmountOfInsurance
AmountOfInsurance decimal(19,2),
Upvotes: 0
Views: 3195
Reputation: 867
I hope this will work for you...
CONVERT(varchar(15), CONVERT(money, AmountOfInsurance), 1)
More information: the last parameter decides what the output format looks like:
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.
If you want to truncate the pennies, and count in pounds, you can use rounding to the nearest pound, floor to the lowest whole pound, or ceiling to round up the pounds
Upvotes: 1