-1
I have a Mysql DBMS with several tables, I searched unsuccessfully how to do a routine, I need to change all URL’s of all tables to another URL.
-1
I have a Mysql DBMS with several tables, I searched unsuccessfully how to do a routine, I need to change all URL’s of all tables to another URL.
1
You can use the information_schema.Columns table to extract the list of columns and tables and assemble the update instructions to run individually. Example:
SELECT
CONCAT('UPDATE ', table_name, ' SET ', column_name, ' = REPLACE(', column_name, ', ''xxx'', ''yyy'');')
FROM
information_schema.columns
WHERE
table_schema = '<SEU BANCO AQUI>'
AND data_type IN ('char, ''varchar', 'text')
ORDER BY
table_name,
ordinal_position;
I tried this and could not, it is news to me, I changed url1 and url2 and the name of the database, I tried in phpmyadmin to execute the command, gave a total of 18 results, but did not change, in DB has the information_schema, but I do not know how to make use of execute and assemble the instructions.
It worked, opaaaa, I saw that you need to print the return view, returned several SQL commands and ran them and was successful, Thank you very much.
Great! Luck and success for you!
Browser other questions tagged php mysql
You are not signed in. Login or sign up in order to post.
Maybe I can help you: https://answall.com/q/29508/89055
– Danilo de Oliveira
This would be a slow process, because there are more than 30 tables in the bank. Thanks for the contribution.
– ElvisP