Archive for Web and Database Development
Mar
16
CONVERT(VARCHAR(10), CONVERT(MONEY, CPRICE)) AS PRICE was all it took…
Posted by: | CommentsBig time DBAs, don’t laugh! But honestly, couldn’t it have been easier to format a numeric value as an amount with decimals? Maybe it will help others trying to format dollar amounts which are stored like 1234.1861 in SQL Server to look like 1234.19, for example. So deceivingly simple…
Here is how I searched BigG and found little:
TSQL display dollar amount
TSQL format dollar amount
TSQL format currency no dollar sign
Just pop this around the field name you need to format and you’re in business!
CONVERT(VARCHAR(10), CONVERT(MONEY, fieldname)) AS PRICE
Cheers!