Link to home
Start Free TrialLog in
Avatar of Jeff S
Jeff SFlag for United States of America

asked on

Help with stripping out character in SQL LEFT/RIGHT/REPLACE

I have the 3 following Zip Codes in my file

76012
75130-6789
76015-3211

Per the flat file spec's from my client, I have to return 9 characters and not use the hyphen that separates the Left 5 from the Right 4. As you can see, I have one that does not have the right 4 characters, how can I strip out the hyphen and return back only the values that I need? I tried LEFT 5 plus Right 4; however, that messed up the one that lacked the Right 4, so that wont work. I tried using the REPLACE and that did not work out as I hoped. I need it to be pad filled if no value.

Any help is appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India 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 Jeff S

ASKER

Cheers! I used REPLACE(cVFG.Zip,'-','')  and it worked great.