1. select statement to format number with decimals and without, using money type and convert function
;WITH cte(d) AS (SELECT CONVERT(VARCHAR, CONVERT(MONEY, 123456789), 1) AS delimited_number) SELECT d , REPLACE(d,'.00', '') sol1 , SUBSTRING(d, 1, LEN(d)-3) sol2 , PARSENAME(d, 2) sol3 FROM cte2. result of select
d sol1 sol2 sol3 ----------------- ------------------ ------------------ ------------------ 123,456,789.00 123,456,789 123,456,789 123,456,789
No comments:
Post a Comment