Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I was trying to update approx 20,000 records in a table by using statements like this one, however, I got the message say 0 row(s) affected so it didn't work.

UPDATE nc_files SET title ="Worklog details" WHERE "log_name" LIKE "%PC01%"

The log_name field has all the file names with mixed file extensions and cases ,e.g.

PC01.TXT | Worklog details

PC02.txt | Project Summary

PC03.DOC| Worklog details

PC04.doc| Project Summary

The reason why I need to use LIKE is that the updated file only have file name without extension, e.g.

PC01 | Worklog details

PC02 | Project Summary

How do I update records by using LIKE?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
722 views
Welcome To Ask or Share your Answers For Others

1 Answer

The log_name is a field name, remove literal quotes from it -

UPDATE nc_files SET title ="Worklog details" WHERE log_name LIKE "%PC01%"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...