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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 not replace if see street already

Author  Topic 

capriman
Starting Member

4 Posts

Posted - 2011-12-10 : 08:35:24
SELECT
REGEXP_REPLACE(STREET_ADDRESS,'St','Street')"REGEXP_PLACE"
FROM LOCATIONS;

using the above I am getting if the street_address already has the word Street in it it makes it Streeteet - so it grabs the St from the beginning and replaces it with Street - I want to ONLY replace if it is JUST St not mess with Street. Anyway I can modify above to handle this??
thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-10 : 08:45:12
Are you using MS SQL Server or Oracle ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-10 : 11:38:50
maybe this small tweak?

SELECT
REGEXP_REPLACE(STREET_ADDRESS,'St ','Street ')"REGEXP_PLACE"
FROM LOCATIONS;


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -