Link to home
Start Free TrialLog in
Avatar of Ilianam
Ilianam

asked on

remove numbers in a sql string

I have a field from where I want to remove the numbers.
Examples
12 Me me
125 just think
56 again
I doesn't have a pattern. Should I use PATINDEX or CHARINDEX?
ASKER CERTIFIED SOLUTION
Avatar of mcmonap
mcmonap
Flag of United Kingdom of Great Britain and Northern Ireland 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 Ilianam
Ilianam

ASKER

I think in that case I will need a cursor in order to navigate through the whole table. Is that true?
No, your will not need a cursor, mcmonap's code above will update the netire column.  It'll just simply replace any intergers, 0-9 with ''.  If they do not exist in a certain record, nothing will take place.
If you need to update mutiple columns, you can include that in the one update statement.  e.i.:

UPDATE <your table name> SET <col1> = REPLACE(col1,@i,''), <col2> = REPLACE(col2,@i,''), <col3> = REPLACE(col3,@i,'')