Originally do not want to tell you, because the collection of other people's website is not a glorious thing, but feel that this technique is strong enough, if this short line of code, I am not exhausted. Is this, collected some other people's article, may be the collection procedure question, each article title has some more characters
| The code is as follows |
Copy Code |
Update dede_addonsoft SET dxylink=replace (Dxylink, '. zip ', '. rar ') where aid > 45553; Update ' table_name ' SET field = replace (field, '. rar ', '. 7z '); |
TABLE_NAME: The name of the table to query,
Field name in the list,
Replace (field, '. rar ', '. 7z '); : Regular match, replacing. rar in field fields with. 7z
Do not see anything, but I looked at the database, WOW!! Really cool, All disappeared, think this statement is really strong, also blame themselves don't understand SQL unexpectedly have so usage ah, later to more research SQL, with less effort AH. So I am afraid to share this experience with you. Another report, I now do not engage in collection, like a person as honest to do the station, look forward to everyone's station also has a good harvest. By the way, the meaning of this line of code:
Update ' table name (for example, my article) ' Set to modify the field name = replace (field name to be modified, ' replaced character ', ' replaced character ')
Add:
MySQL Replace usage
1.replace into
Replace into table (Id,name) VALUES (' 1 ', ' AA '), (' 2 ', ' BB ')
The purpose of this statement is to insert two records into table tables. If the primary key ID is 1 or 2 does not exist
is equivalent
Insert into table (Id,name) VALUES (' 1 ', ' AA '), (' 2 ', ' BB ')
Data is not inserted if the same value exists
2.replace (Object,search,replace)
Replaces all occurrences of search in object with replace
Select replace (' www.163.com ', ' w ', ' Ww ')--->wwwwww.163.com
To replace a AA in the Name field in table tables with BB
Update table Set Name=replace (name, ' AA ', ' BB ')