How to Find and Replace Text in MySQL Database using SQL Cómo buscar y reemplazar texto en la base de datos MySQL usando SQL

MySQL database has a handy and simple string function REPLACE() that allows table data with the matching string (from_string) to be replaced by new string (to_string). Base de datos MySQL cuenta con un práctico y sencillo cadena función REPLACE () que permite que los datos de la tabla con la correspondiente cadena (from_string) para ser sustituidas por nuevas cadenas (to_string). This is useful if there is need to search and replace a text string which affects many records or rows, such as change of company name, postcode, URL or spelling mistake. Esto es útil si hay necesidad de buscar y reemplazar una cadena de texto que afecta a muchos registros o filas, como el cambio de nombre de la empresa, código postal, URL o error de ortografía.

The syntax of REPLACE is REPLACE(text_string, from_string, to_string) La sintaxis de REPLACE se REPLACE (text_string, from_string, to_string)

MySQL reference MySQL referencia describes REPLACE as function that returns the string text_string with all occurrences of the string from_string replaced by the string to_string, where matching is case-sensitive when searching for from_string. REPLACE describe como la función que devuelve la cadena text_string con todas las ocurrencias de la cadena from_string sustituye por la cadena to_string, cuando se pongan en venta se distingue entre mayúsculas y minúsculas al buscar from_string. text_string can be retrieved from the a field in the database table too. text_string puede obtenerse en el un campo en la tabla de base de datos. Most SQL command can be REPLACE() function, especially SELECT and UPDATE manipulation statement. La mayoría de comandos SQL puede REPLACE (), especialmente SELECT y UPDATE manipulación declaración.

For example: Por ejemplo:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’); actualización TABLE_NAME conjunto FIELD_NAME = sustituir (FIELD_NAME, 'encontrar esta cadena »,« sustituir encontrado cadena con esta cadena');

update client_table set company_name = replace(company_name, ‘Old Company’, ‘New Company’) actualización client_table conjunto company_name = sustituir (company_name, «antigua empresa», «Nueva Empresa»)

The above statement will replace all instances of ‘Old Company’ to ‘New Company’ in the field of company_name of client_table table. La declaración anterior sustituirá a todos los casos de «antigua empresa» a «Nueva Empresa» en el ámbito de company_name de client_table mesa.

Another example: Otro ejemplo:

SELECT REPLACE(’www.mysql.com’, ‘w’, ‘Ww’); SELECT REPLACE ( 'www.mysql.com', 'w', 'Ww');

Above statement will return ‘WwWwWw.mysql.com’ as result. Por encima de declaración retorno »WwWwWw.mysql.com 'como resultado.

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Se trata de una máquina que traduzca la página se proporciona "tal cual" sin garantía. Machine translation may be difficult to understand. La traducción automática puede resultar difícil de entender. Please refer to Por favor, consulte original English article artículo original Inglés whenever possible. siempre que sea posible.

Share and contribute or get technical support and help at Compartir y contribuir o recibir apoyo técnico y ayudar a My Digital Life Forums Mi vida digital Foros .



5 Responses to “How to Find and Replace Text in MySQL Database using SQL” 5 Respuestas a "Cómo buscar y reemplazar texto en la base de datos MySQL usando SQL"

  1. masterik
    May 4th, 2007 05:48 4 de mayo, 2007 05:48
    1

    Thanks a lot! ¡Muchas gracias! You’ve saved my life! Usted ha salvado mi vida!

  2. yourtronica
    May 11th, 2007 10:38 Mayo 11, 2007 10:38
    2

    Thanks for the help! Gracias por la ayuda!

  3. Joost
    May 16th, 2007 07:24 16 de mayo de 2007 07:24
    3

    Excellent, just what I needed. Excelente, justo lo que necesitaba. Thanks! Gracias!

  4. How to Move WordPress Blog to New Domain or Location » My Digital Life Cómo pasar a WordPress blog nuevo dominio o lugar »Mi vida digital
    October 1st, 2007 18:23 1 de octubre de 2007 18:23
    4

    [...] The guide uses SQL statements based on MySQL replace() function to modify the database. [...] La guía utiliza comandos SQL sobre la base de sustituir MySQL () para modificar la base de datos. To run SQL queries, login to MySQL database that houses WordPress tables [...] Para ejecutar consultas SQL, acceso a base de datos MySQL que alberga los cuadros de WordPress [...]

  5. Monica
    June 4th, 2008 15:43 4 de Junio, 2008 15:43
    5

    thanks, this is very helpful!! gracias, esto es muy útil!

Leave a Reply Deja Responder

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Puede usar estos tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe without commenting Suscribirse sin comentar


Custom Search

New Articles Nuevos Artículos

Incoming Search Terms for the Article Próximos Términos de búsqueda para el artículo

mysql replace MySQL sustituir - -- sql replace SQL sustituir - -- replace mysql sustituir MySQL - -- mysql find and replace MySQL buscar y reemplazar - -- sql replace command SQL sustituir comando - -- Mysql find replace Mysql encontrar sustituir - -- sql find replace SQL encontrar sustituir - -- mysql string replace MySQL cadena sustituir - -- mysql replace string MySQL reemplazar cadena - -- mysql replace text MySQL reemplazar texto - -- SQL replace text SQL reemplazar texto - -- REPLACE SQL SUSTITUCION DE SQL - -- MySQL replace function MySQL sustituir la función - -- sql search and replace SQL búsqueda y reemplazo - -- mysql search and replace MySQL búsqueda y reemplazo - -- sql find and replace SQL para buscar y reemplazar - -- mySQL search replace mySQL búsqueda sustituir - -- REPLACE IN MYSQL Sustituir en mysql - -- sql replace string SQL reemplazar cadena - -- sql replace function sustituir la función de SQL - -- mysql replace syntax sustituir la sintaxis de MySQL - -- mysql replace MySQL sustituir - -- find and replace in sql buscar y reemplazar en SQL - -- replace in sql sustituir en SQL - -- find and replace sql buscar y reemplazar SQL - -- mysql replace example MySQL sustituir ejemplo - -- sql string replace SQL cadena sustituir - -- find replace mysql encontrar sustituir MySQL - -- find replace sql encontrar sustituir SQL - -- find and replace mysql buscar y reemplazar MySQL - -- sql replace mysql SQL sustituir MySQL - -- REPLACE command in sql REPLACE comando en SQL - -- SQL replace SQL sustituir - -- sql replace syntax sustituir la sintaxis SQL - -- replace sql command sustitución de comando SQL - -- replace text mysql reemplazar texto de MySQL - -- mysql replace command MySQL sustituir comando - -- mysql text replace MySQL reemplazar texto - -- find and replace SQL query buscar y reemplazar la consulta SQL - -- replace text sql reemplazar texto SQL - -- MySQL Replace() Sustituir MySQL () - -- search and replace mysql búsqueda y reemplazo de MySQL - -- search replace mysql sustituir la búsqueda de MySQL - -- mysql sql REPLACE MySQL SQL REPLACE - -- mysql search and replace text MySQL búsqueda y reemplazo de texto - -- mysql find MySQL encontrar - -- string replace mysql cadena sustituir MySQL - -- mysql replace sql MySQL sustituir SQL - -- MySQL REPLACE statement MySQL declaración REPLACE - -- sql replace all SQL sustituir todos - -- all todo - -- mysql update replace text MySQL actualización reemplazar texto - -- REPLACE function sql REPLACE función SQL - -- sql + replace + SQL sustituir - -- replace text in mysql reemplazar texto en MySQL - -- find replace in sql encontrar sustituir a SQL - -- mysql replace string function MySQL sustituir la función de cuerda - -- string replace SQL sustituir cadena SQL - -- sql replace examples SQL sustituir ejemplos - -- replace function in sql sustituir en función de SQL - -- sql search replace SQL sustituir búsqueda - -- sql replace example SQL sustituir ejemplo - -- find and replace in mysql buscar y reemplazar a MySQL - -- sql command replace SQL comando sustituir - -- search and replace in mysql búsqueda y reemplazo en MySQL - -- mysql replace text MySQL reemplazar texto - -- mysql replace table MySQL sustituir el cuadro - -- sql text replace SQL reemplazar texto - -- replace text in SQL reemplazar texto en SQL - -- replace command sql sustitución de comando SQL - -- sql replace statement SQL sustituir declaración - -- sql find text SQL encontrar texto - -- replace string sql sustituir cadena SQL - -- mysql + replace MySQL + sustituir - -- mysql text search and replace MySQL texto de búsqueda y reemplazo - --