-1

Table A data

ID NAME
1 (abhe)
2 (gd
3 good
4 bfhd)

I want the result as below

ID NAME
1 abhe
2 gd
3 good
4 bfhd

How to solve this please? Guide me.

Thanks in advance.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Swetha
  • 3
  • 2
  • What did you tried ? – Magicprog.fr Jul 10 '15 at 09:11
  • What RDBMS? Please also **explain** in English what you're trying to do - don't just dump a *before* and *after* on us and let us **guess** what it is you want to do ...... – marc_s Jul 10 '15 at 09:11
  • Duplicate of : http://stackoverflow.com/questions/1007697/how-to-strip-all-non-alphabetic-characters-from-string-in-sql-server – PKirby Jul 10 '15 at 09:12
  • What if there are a '(' or ')' somewhere inside the text, keep or remove? Or a ')' first, or a '(' last? – jarlh Jul 10 '15 at 09:30
  • That can be done using this query select id,replace(replace(name,'(',''),')','') from table_name; – Swetha Jul 10 '15 at 12:22

1 Answers1

0

ANSI SQL answer, to remove leading ( and trailing ):

select id, TRIM(leading '(' from TRIM(trailing ')' from name))
from tablename
jarlh
  • 42,561
  • 8
  • 45
  • 63