Mar
16

CONVERT(VARCHAR(10), CONVERT(MONEY, CPRICE)) AS PRICE was all it took…

By

Big 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!

Leave a Comment

You must be logged in to post a comment.

Tags

 

February 2012
S M T W T F S
« Jan    
 1234
567891011
12131415161718
19202122232425
26272829