Thursday, March 26, 2015

REPLACE statement removing commas from a money convert... I do NOT want it to do this

The style you've applied is being overridden by the implicit conversion to a plain old varchar. Those commas were never really there.


You should being doing your formatting in your presentation layer, not in the database.


Try this instead:



SELECT CASE WHEN @val < 0 THEN '(' + CONVERT(VARCHAR, ABS(@val),1) + ')'
ELSE CONVERT(VARCHAR, ABS(@val),1)
END





Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.













No comments:

Post a Comment