Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

replace syntax

I want to remove the '-' character and any spaces ' ' from a string. I am trying to do a double replace but my syntax seems icnorrect.
This seems to work for replacing the '-' but I am not sure what the syntax will be to also remove the spaces

(Replace(a.fieldname,'-','') AS fieldnameclear)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robb Hill
Not quite sure I understand.  I think you want to replace a string value where you find a "-" with a space.

What exact language do you need this in.

SQL, asp.net....please tell me so I can provide the best syntax.



Also.

Provice the test strings that cover all scenarios.


In SQL and in most modern programming languages we have a replace or string manipulation function.

If it gets too crazy we can do pattern matching or even regex.

So for 100% answer..please provide your 100%  scenario.

Also please provide if you want this to happen in code...versus database.  We can do this several ways and in both places.

Thanks,
Avatar of Aleks

ASKER

Great!