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 |
|
paul.rowling
Yak Posting Veteran
81 Posts |
Posted - 2003-03-17 : 13:54:50
|
| Hi,I have a table which stores address data. In one of the fields there is text which contains comma's. What I want to be able to do is to remove the comma's leaving the remaining text intact.An example of the text would be:"Unit 1, The Pastures"How do I go about doing this?Many ThanksPaul |
|
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2003-03-17 : 13:59:13
|
| Check out the REPLACE function.UPDATE Table SET Address = REPLACE(Address,',','')Sarah Berger MCSD |
 |
|
|
paul.rowling
Yak Posting Veteran
81 Posts |
Posted - 2003-03-17 : 16:13:48
|
| Thanks Alot Sharah, worked great!!CheersPaul |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-03-17 : 20:21:18
|
Just a little something to keep in mind for next time.... That code wouldn't have actually worked on a "Text" field. Obviously you have a varchar field.Most people here would have told you that you can not do a replace on a Text field and you would have gone away thinking it can't be done.Giving the right info usually makes for a better answer, you got lucky this time around Damian |
 |
|
|
paul.rowling
Yak Posting Veteran
81 Posts |
Posted - 2003-03-18 : 07:06:37
|
| Sorry, looking back at my question it is a bit misleadng. The field I wanted to manipulate was indeed an nvarchar field and not text as you outlined. I'll remember that for the future!! |
 |
|
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2003-03-18 : 12:33:52
|
| Good point, Merkin.I am aware that replace can't be used in a TEXT field, but I think that most newbies, (no insult intended, Paul) will be calling the char/varchar types "text", being unaware of what actual TEXT/IMAGE types are.Sarah Berger MCSD |
 |
|
|
|
|
|
|
|