How to Find and Replace Text in MySQL Database using SQL Kā lai atrastu un aizstātu tekstu ar MySQL datu bāzi, izmantojot 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). MySQL datubāze ir ērts un vienkāršs string funkcija REPLACE (), kas ļauj tabulas datus ar atbilstības string (from_string), ko aizstāj ar jaunu 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. Tas ir noderīgi, ja ir nepieciešams, lai meklētu un aizvietotu teksta virkne, kas skar daudzus ierakstus vai rindas, piemēram, pārmaiņas uzņēmuma nosaukums, pasta indekss, URL vai pareizrakstības kļūda.

The syntax of REPLACE is REPLACE(text_string, from_string, to_string) No REPLACE sintakse ir REPLACE (text_string, from_string, to_string)

MySQL reference MySQL atsauces 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. apraksta REPLACE kā funkcija, kas atgriež virkni text_string ar visu stīgu from_string aizstāj ar string to_string, ja saskaņošana ir reģistrjutīga, meklējot from_string notikumi. text_string can be retrieved from the a field in the database table too. text_string var iegūt no lauka datu bāzes tabulā too. Most SQL command can be REPLACE() function, especially SELECT and UPDATE manipulation statement. Lielākā daļa SQL komanda var tikt REPLACE () funkcija, it īpaši SELECT un UPDATE manipulācijas paziņojumu.

For example: For example:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string'); update TABLE_NAME kas FIELD_NAME = REPLACE (FIELD_NAME "atrast šajā string", "aizstāj konstatēja virkni ar šo string ');

update client_table set company_name = replace(company_name, 'Old Company', 'New Company') update client_table kas company_name = REPLACE (company_name "Old Company", "New Company")

The above statement will replace all instances of 'Old Company' to 'New Company' in the field of company_name of client_table table. Iepriekš minētais apgalvojums aizstās visus "gadījumiem Old Company" ar "Jaunā Company" šajā jomā company_name no client_table tabulā.

Another example: Vēl viens piemērs:

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

Above statement will return 'WwWwWw.mysql.com' as result. Iepriekš minētais apgalvojums būs atgriešanās "WwWwWw.mysql.com" kā rezultāts.

IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: lapa mašīna iztulkot un pasniegts tàds, "kàds tas ir" bez garantijas. Machine translation may be difficult to understand. Mašīntulkošanas var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.


28 Responses to “How to Find and Replace Text in MySQL Database using SQL” 28 Atbildes uz "Kā lai atrastu un aizstātu tekstu ar MySQL datu bāzi, izmantojot SQL"

Pages: [2] Lapas: [2] 1 1 » » Show All Parādīt visus

  1. timtak timtak
    October 28th, 2009 09:00 28 oktobris 2009 09:00
    28 28

    I am looking for a way to do this globally accross a whole database. Es meklēju veids, kā to globāli pāri visa datubāze.

  2. kevin Kevin
    October 20th, 2009 20:28 20 oktobris 2009 20:28
    27 27

    Doesn't work at all for replacing web addresses within a database. Nedarbojas visos nomaiņai Web adreses, kas datu bāzē.

  3. vishwas vishwas
    September 30th, 2009 15:26 30 septembris 2009 15:26
    26 26

    Wanted to use REPLACE command to use for a column of a table…and this helped me…thanks Gribēja izmantot REPLACE komanda izmantot kolonnas galda ... un tas palīdzēja man ... paldies

Pages: [2] Lapas: [2] 1 1 » » Show All Parādīt visus

Leave a Reply Leave a Reply

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> Jūs varat izmantot šos tagus: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Parakstīties uz komentāriem iezīme ir atspējota. To receive notification of latest comments posted, subscribe to Saņemt informāciju par jaunāko komentārus, parakstīties uz My Digital Life Comments RSS feed Mana Digital Life Comments RSS feed or vai register to receive reģistrēties, lai saņemtu new comments in daily email digest. jauni komentāri ikdienas e-pasta sagremot.
Custom Search

New Articles Jauns pants

Incoming Search Terms for the Article Ienākošo Meklēt noteikumi pants

mysql replace mysql aizstāt - -- MySQL replace text MySQL aizstāt tekstu - -- sql find and replace sql atrast un nomainīt - -- mysql replace string mysql aizstāt string - -- replace mysql nomainīt mysql - -- mysql find and replace mysql atrast un nomainīt - -- sql find replace sql atrast aizstāt - -- mysql replace example mysql aizstāt piemērs - -- sql search and replace sql meklēt un aizstāt - -- sql replace text sql aizstāt tekstu - -- mysql update replace mysql update aizstāt - -- mysql string REPLACE mysql string REPLACE - -- mysql find replace mysql atrast aizstāt - -- sql replace command sql nomainīt komandu - -- find and replace sql Atrast un aizstāt sql - -- replace in mysql aizvietot mysql - -- find and replace in sql Atrast un aizstāt ar sql - -- find and replace mysql Atrast un aizstāt mysql - -- MySQL search and replace MySQL meklēt un aizstāt - -- MYSQL REPLACE SYNTAX MYSQL REPLACE sintakse - -- sql replace sql aizstāt - -- find replace sql atrast aizstāt sql - -- mysql text replace mysql tekstu aizstāj - -- mysql replace function mysql aizstāt funkcija - -- sql search replace sql meklēšana aizstāt - -- mysql replace character mysql aizvietot raksturs - -- mysql find mysql atrast - -- replace mysql example nomainīt mysql piemērs - -- mysql find and replace text mysql atrastu un aizstātu tekstu - -- find replace mysql atrast nomainīt mysql - -- mysql replace command mysql nomainīt komandu - -- sql replace string sql aizstāt string - -- mysql REPLACE mysql REPLACE - -- mysql search and replace string mysql search and replace string - -- replace mysql syntax nomainīt mysql sintakse - -- replace sql aizstāt sql - -- search and replace sql meklēt un aizstāt sql - -- replace command in sql nomainīt komandu sql - -- mysql sql replace mysql sql aizstāt - -- update replace mysql update nomainīt mysql - -- replace text mysql Aizvietot tekstu mysql - -- sql find and replace query sql atrastu un aizstātu query - -- search and replace mysql meklēt un aizstāt mysql - -- FIND AND REPLACE IN MYSQL Atrast un aizvietot MYSQL - -- mysql query replace text mysql query aizstāt tekstu - -- mysql update replace string mysql update aizstāt string - -- mysql find replace text mysql atrast Aizvietot tekstu - -- replace sql mysql aizstāt sql mysql - -- search replace sql meklēt aizstāt sql - -- mysql search replace mysql meklēšana aizstāt - --