how can I make this output:
Total
62809.44
91686.34
70671.29
to be
$62.81
$91.69
$70.67
i want mo move the decimal places to the left 3 times, round and then add a character. thanks
Try following
select '$' + CONVERT(NVARCHAR(100), ROUND(70671.29/1000,2))
If you want to remove trailing zeros, try following.
select '$' + CONVERT(NVARCHAR(100),CAST( ROUND(70671.29/1000,2) AS DECIMAL(5,2)))
SELECT
'$' + FORMAT(v / 1000, 'n2'), -- 2012+
'$' + LEFT(CAST(v / 1000 AS DECIMAL(18,2)), 20) -- 2005+
FROM (
VALUES
(62809.44),
(91686.34),
(70671.29)
) t(v)
Output -
---------
$62.81
$91.69
$70.67
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With