This is really easy to do in following way. Have a look on below snippets:
DECLARE @NumberValue varchar(100) SET @NumberValue = '1234567891234.45' SELECT CONVERT(VARCHAR,CONVERT(MONEY,@NumberValue),1)
Result:1,234,567,891,234.45
If you need to add any decimal places, just use following snippet to handle it.
DECLARE @NumberValue varchar(100) SET @NumberValue = '1234567891234' SELECT CONVERT(VARCHAR,CONVERT(MONEY,@NumberValue),1)
Result:1,234,567,891,234.00
No comments:
Post a Comment