sql - Convert numeric (contains special characters) to money -


given

declare @text varchar(4) ='3677.98*' , @text2 varchar(4) ='1245367.98%' 

i want output follows:

3,677.98* , 1,245,367.98%

i tried below:

select convert(varchar,cast(3677.98 money),1) --output 3,677.98 

if try select convert(varchar,cast(3677.98* money),1) gives error incorrect syntax near keyword 'as'.

if want convert varchar money format, currency symbols can use in this chart, msdn. * , % not qualify.

if want store number amount , special character, need either store them varchar or use 2 columns, money , varchar.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -