How do i put commas so 1234567
comes out as 1,234,567
i know how to put $ in front but i cant figure out how to put commas in the middle of a no. Can anybody help?
i am new at all of this.
I agree with robert about formating the ouput in the UI layer. But if you insist, then see function "convert" in BOL.
selectreverse(stuff(reverse(convert(char(25),cast(1234567 asmoney), 1)), 1, 3,''))
AMB
|||If you are attempting to format currency, try this:
Code Snippet
SELECT ( '$' + convert( varchar(25), cast( 1234567 AS money ), 1 ))
--
$1,234,567.00
No comments:
Post a Comment