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 |
jej1216
Starting Member
27 Posts |
Posted - 2008-10-17 : 14:34:39
|
I need to select employee names from a table. I am finding that names may have a comma (Joe Smith, Jr) or an apostrophe (Frank O'Neil).I know I can use this to get rid of one of the characters:SELECT COMPANY ,EMPLID,CONVERT(CHAR(30),(REPLACE(NAME,',',' '))) AS NAMEFROM EE_TBLetc.I need to replace the apostrophe as well - all in the same select.My attempts to repeat REPLACE on the same field errors out:CONVERT(CHAR(30),(REPLACE(NAME,',',' ')),(REPLACE(NAME,'''',' '))) AS NAMEArgument data type varchar is invalid for argument 3 of convert function.Is there a way to replace two characters in the same field during a select? I need to replace the comma and the apostrophe with spaces.TIA,jej1216 |
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-10-17 : 17:08:32
|
[CODE]REPLACE(REPLACE(NAME,',',''),'''','')[/CODE] |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|