Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Double Spaces from a field ??? 1

Status
Not open for further replies.

Connatic

Programmer
Apr 22, 2004
45
GB

Hi, I have an Address Field in a table, that is a bit of a mess, and I am trying to clean it up.

The first step I would like to do is to remove all the Double spaces for the records in this column, and by this I mean, reducing any double space to a single space!

Joe Bloggs --> would become --> Joe Bloggs

Does any body have any ideas ???
 
Repeat this until you get "0 row(s) affected" message:
update mytable set address = replace(address, ' ', ' ')
 
that would need a where clause

select 1
while @@rowcount > 0
update mytable set address = replace(address, ' ', ' ')
where address like '% %'

======================================
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top