Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cray
Starting Member
9 Posts |
Posted - 2005-11-01 : 12:57:31
|
| I just use SQL for queries & some stored procedures. Not a developer.Question: How can I use replace more than once to eliminate characters? I want to eliminate all " ", "." in a lastname field. Right now that field has things like: 'DOE JR.' or 'ADAMS, SR.'I want to eliminate commas and spaces. I tried below with a % but didn't work.Select replace(lastname,', JR.','JR') [and replace(lastname,', SR.','SR')]From tablename |
|
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2005-11-01 : 13:04:11
|
| Try This outSelect replace(replace(lastname,', JR.','JR'),', SR.','SR')From tablenameregardsSachin |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-11-01 : 13:04:22
|
| replace(replace(fld,',',''),' ','')==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|