How to Find and Replace Text in MySQL Database using SQL Como Localizar e substituir texto em SQL usando o MySQL Database

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). O MySQL tem um banco de dados acessível e simples string função REPLACE () que permite que os dados com a tabela de correspondência string (from_string), para ser substituída por nova string (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. Isso é útil se houver necessidade de pesquisa e de substituir uma cadeia de texto que afecta muitos registros ou linhas, tais como a mudança de nome da empresa, código postal, ou URL erro de ortografia.

The syntax of REPLACE is REPLACE(text_string, from_string, to_string) A sintaxe é de REPLACE REPLACE (text_string, from_string, to_string)

MySQL reference MySQL referência 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 descreve como função que retorna a string text_string com todas as ocorrências da string from_string substituída pela string to_string, onde correspondência é sensível a maiúsculas e minúsculas quando procurando por from_string. text_string can be retrieved from the a field in the database table too. text_string podem ser recuperadas a partir de um campo na tabela do banco de dados também. Most SQL command can be REPLACE() function, especially SELECT and UPDATE manipulation statement. A maioria dos comandos SQL pode ser REPLACE (), SELECT e UPDATE especialmente manipulação declaração.

For example: Por exemplo:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’); atualização TABLE_NAME conjunto substituir FIELD_NAME = (FIELD_NAME ', localize a string', 'string substituir encontrado com essa string');

update client_table set company_name = replace(company_name, ‘Old Company’, ‘New Company’) atualização client_table conjunto company_name substituir = (company_name, 'Old Company "," Nova Empresa ")

The above statement will replace all instances of ‘Old Company’ to ‘New Company’ in the field of company_name of client_table table. A declaração acima irá substituir todas as instâncias de 'Old Company "para a" nova sociedade ", no domínio do company_name de client_table tabela.

Another example: Outro exemplo:

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

Above statement will return ‘WwWwWw.mysql.com’ as result. Declaração acima irá retornar 'WwWwWw.mysql.com' como resultado.

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Esta é uma página traduzida máquina que é fornecida "como está" sem garantia. Machine translation may be difficult to understand. A tradução automática pode ser difícil de compreender. Please refer to Por favor, consulte a original English article Inglês original article whenever possible. sempre que possível.

Share and contribute or get technical support and help at Compartilhe e contribuir ou obter suporte técnico e ajudar a My Digital Life Forums Minha vida digital Fóruns .



5 Responses to “How to Find and Replace Text in MySQL Database using SQL” 5 Responses para "Como localizar e substituir texto em SQL usando o MySQL Database"

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

    Thanks a lot! Thanks a lot! You’ve saved my life! Você salvou a minha vida!

  2. yourtronica
    May 11th, 2007 10:38 11 de maio de 2007 10:38
    2

    Thanks for the help! Obrigado pela ajuda!

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

    Excellent, just what I needed. Excelente, só o que eu precisava. Thanks! Obrigado!

  4. How to Move WordPress Blog to New Domain or Location » My Digital Life Como se deslocar para WordPress blog novo domínio ou localização "Minha vida digital
    October 1st, 2007 18:23 Outubro 1o, 2007 18:23
    4

    [...] The guide uses SQL statements based on MySQL replace() function to modify the database. [...] O guia utiliza instruções SQL baseado em MySQL substituir () função de modificar a base de dados. To run SQL queries, login to MySQL database that houses WordPress tables [...] Para executar consultas SQL, login de banco de dados MySQL que abriga WordPress tabelas [...]

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

    thanks, this is very helpful!! graças, este é muito útil!

Leave a Reply Deixe uma resposta

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> Você pode usar estas tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe without commenting Subscreva sem comentar


Custom Search

New Articles Novos Artigos

Incoming Search Terms for the Article Incoming Termos de pesquisa para o artigo

mysql replace MySQL substituir - -- sql replace SQL substituir - -- replace mysql substituir o MySQL - -- mysql find and replace MySQL localizar e substituir - -- sql replace command substituir comando SQL - -- Mysql find replace Mysql encontrar substituir - -- sql find replace SQL encontrar substituir - -- mysql string replace MySQL substituir string - -- mysql replace string MySQL substituir string - -- mysql replace text MySQL substituir texto - -- SQL replace text SQL substituir texto - -- REPLACE SQL REPLACE SQL - -- MySQL replace function MySQL substituir função - -- sql search and replace SQL pesquisa e substituição - -- mysql search and replace MySQL pesquisa e substituição - -- sql find and replace SQL localizar e substituir - -- mySQL search replace mySQL busca substituir - -- REPLACE IN MYSQL Substituir no mysql - -- sql replace string SQL substituir string - -- sql replace function SQL substituir função - -- mysql replace syntax MySQL substituir sintaxe - -- mysql replace MySQL substituir - -- find and replace in sql localizar e substituir em SQL - -- replace in sql substituir no SQL - -- find and replace sql localizar e substituir SQL - -- mysql replace example MySQL substituir exemplo - -- sql string replace SQL string substituir - -- find replace mysql encontrar substituir MySQL - -- find replace sql encontrar substituir SQL - -- find and replace mysql localizar e substituir MySQL - -- sql replace mysql SQL substituir MySQL - -- REPLACE command in sql REPLACE no comando SQL - -- SQL replace SQL substituir - -- sql replace syntax substituir sintaxe SQL - -- replace sql command substituir comando SQL - -- replace text mysql substituir texto MySQL - -- mysql replace command MySQL substituir comando - -- mysql text replace MySQL substituir texto - -- find and replace SQL query localizar e substituir consulta SQL - -- replace text sql substituir texto SQL - -- MySQL Replace() Substituir o MySQL () - -- search and replace mysql pesquisa e substituí MySQL - -- search replace mysql pesquisa substituir MySQL - -- mysql sql REPLACE MySQL SQL REPLACE - -- mysql search and replace text MySQL procurar e substituir texto - -- mysql find MySQL encontrar - -- string replace mysql string substituir MySQL - -- mysql replace sql MySQL substituir SQL - -- MySQL REPLACE statement REPLACE MySQL declaração - -- sql replace all SQL substituir todos - -- all todos - -- mysql update replace text MySQL atualizar substituir texto - -- REPLACE function sql REPLACE função SQL - -- sql + replace SQL + substituirá - -- replace text in mysql substituir texto em MySQL - -- find replace in sql encontrar substituir no SQL - -- mysql replace string function MySQL substituir função string - -- string replace SQL substituir string SQL - -- sql replace examples SQL substituir exemplos - -- replace function in sql substituir, em função SQL - -- sql search replace SQL substituir pesquisa - -- sql replace example SQL substituir exemplo - -- find and replace in mysql localizar e substituir em MySQL - -- sql command replace substituir comando SQL - -- search and replace in mysql pesquisa e substituição no MySQL - -- mysql replace text MySQL substituir texto - -- mysql replace table MySQL substituir tabela - -- sql text replace SQL substituir texto - -- replace text in SQL substituir texto em SQL - -- replace command sql substituir comando SQL - -- sql replace statement SQL substituir declaração - -- sql find text SQL encontrar texto - -- replace string sql substituir string SQL - -- mysql + replace MySQL + substituirá - -- mysql text search and replace MySQL procurar e substituir texto - --