0

I have a table name "Table1" and I want to update John's last name which is spelled incorrectly as Do and it needs to be Doe.

Table1 currently has 65 rows of John Do, will this work? This table is in active use by an application.

UPDATE
TABLE1
SET LASTNAME = 'DOE'
WHERE LASTNAME LIKE '%DO%'
1
  • Caveat: It will also include LASTNAMEs like 'FIODOR'. Try out your SELECT LASTNAME WHERE LASTNAME LIKE '%DO%' to be sure to only catch 'DO's you intend to update. Commented Oct 12, 2020 at 15:23

1 Answer 1

3

Yes, all entries that have the LASTNAME containing 'DO' will be updated to 'DOE'

If you want to make sure you don't update anything else, I suggest changing your query to:

UPDATE
TABLE1
SET LASTNAME = 'DOE'
WHERE LASTNAME = 'DO' AND FIRSTNAME = 'John'

Note that the strings are case sensitive, so you should probably change 'DO' to 'Do'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.