• 0

[SQL]updateing part of a record.


Question

OK we what i am attempting to so is update part of a record in our database. In our call center people do not use the same abbreviation for street, avenue, and the like. So we want to run a SQL query to just search and replace data in those records.

Here is what we have come up with however it does not work correctly

update OECSSL set DNL1TX = 'ST' where DNCOMP = 10 and DNL1TX =
'STREET'

OECSSL = the Database

DNL1TX equals the address column

ST is what we would search for as the incorrect item that we want to replace with Street.

and we want to update records that have a DNCOMP that = 10 (DNCOMP is a column)

Currently with how this works, if the entire field = ST it will fix it, however if there is other data such as the whole address it will ignore it.

Any help would be much appreciated Thank you.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

We attempted that as well however once we ran that query it did not find anything at all where as before it would at least find the record.

Link to comment
Share on other sites

  • 0

We are attempting to change any version of complete name or incorrect abbreviation to a corrected standard abbreviation. so in this case Street. to ST.

Link to comment
Share on other sites

  • 0

the way you've coded it only an address of "Street" would get changed. Meaning, "100 W. Elm Street" would never be found.

Try this:

update OECSSL set

DN1TX = SELECT REPLACE(DN1TX, ?Street?, ?ST?)

where DNCOMP = 10

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.