How to Find and Replace Text in MySQL Database using SQL כיצד לחפש ולהחליף טקסט ב-MySQL מסד נתונים באמצעות 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 יש תפקיד שימושי ופשוט מחרוזת REPLACE () המאפשר הנתונים בטבלה עם החוט תואמים (from_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. אפשרות זו שימושית אם יש צורך לבצע חיפוש והחלפה של מחרוזת טקסט אשר משפיע רבות רשומות או שורות, כגון שינוי שם החברה, מיקוד, כתובת או טעות כתיב.

The syntax of REPLACE is REPLACE(text_string, from_string, to_string) התחביר של REPLACE הוא להחליף (text_string, from_string, to_string)

MySQL reference התייחסות MySQL 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 כמו לפונקציה המחזירה את text_string מחרוזת עם כל המופעים של המחרוזת from_string הוחלף to_string את המחרוזת, איפה ההתאמה הוא תלוי רישיות כאשר מחפשים from_string. text_string can be retrieved from the a field in the database table too. text_string ניתן לאחזר מהשדה בטבלה מסד נתונים מדי. Most SQL command can be REPLACE() function, especially SELECT and UPDATE manipulation statement. רוב פקודת SQL ניתן REPLACE () function, במיוחד SELECT ולעדכן הצהרה מניפולציה.

For example: לדוגמה:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string'); עדכון table_name להגדיר field_name = להחליף (field_name, "למצוא את המחרוזת ',' מצא מחליף מחרוזת במחרוזת זה ');

update client_table set company_name = replace(company_name, 'Old Company', 'New Company') עדכון company_name להגדיר client_table = להחליף (company_name, 'החברה הישנה', 'החברה החדשה')

The above statement will replace all instances of 'Old Company' to 'New Company' in the field of company_name of client_table table. ההצהרה לעיל יחליף את כל המופעים של 'החברה הישנה' ל 'חברה חדשה' בתחום company_name של שולחן client_table.

Another example: דוגמה נוספת:

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

Above statement will return 'WwWwWw.mysql.com' as result. מעל הצהרה יחזיר 'WwWwWw.mysql.com' כתוצאה.

IMPORTANT : The page is machine translated and provided "as is" without warranty. חשוב: הדף מכונת תירגם מתפרסם "כמות שהוא" ללא אחריות. Machine translation may be difficult to understand. תרגום מכונה יכול להיות קשה להבין. Please refer to נא עיין original English article המאמר המקורי באנגלית whenever possible. בכל הזדמנות אפשרית.


26 Responses to “How to Find and Replace Text in MySQL Database using SQL” 26 תגובות ל "כיצד לחפש ולהחליף טקסט ב-MySQL מסד נתונים באמצעות SQL"

Pages: [2] עמודים: [2] 1 1 » » Show All הצג הכל

  1. vishwas vishwas
    September 30th, 2009 15:26 30 ספטמבר 2009 15:26
    26 26

    Wanted to use REPLACE command to use for a column of a table…and this helped me…thanks רצה להשתמש בפקודה REPLACE להשתמש עבור עמודה של טבלה ... וזה עזר לי ... תודה

Pages: [2] עמודים: [2] 1 1 » » Show All הצג הכל

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> באפשרותך להשתמש בתגים אלה: <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. כדי להירשם הערות תכונה הושבת. To receive notification of latest comments posted, subscribe to כדי לקבל הודעה העדכנית של תגובות, כדי להירשם My Digital Life Comments RSS feed החיים שלי דיגיטליות תגובות RSS Feed or או register to receive הרשמה לקבלת new comments in daily email digest. תגובות חדש ב דוא"ל תקציר יומי.
Custom Search

New Articles מאמרים חדשים

Incoming Search Terms for the Article תנאי נכנסות חיפוש עבור מאמרים

mysql replace MySQL להחליף - -- sql replace SQL להחליף - -- replace mysql להחליף MySQL - -- mysql find and replace MySQL למצוא ולהחליף - -- sql replace command SQL להחליף את הפקודה - -- Mysql find replace Mysql למצוא מחליף - -- sql find replace SQL למצוא מחליף - -- mysql string replace מחרוזת MySQL להחליף - -- mysql replace string MySQL להחליף מחרוזת - -- mysql replace text MySQL להחליף טקסט - -- SQL replace text SQL להחליף טקסט - -- REPLACE SQL REPLACE SQL - -- MySQL replace function MySQL להחליף את הפונקציה - -- sql search and replace חיפוש והחלפה של SQL - -- mysql search and replace חיפוש MySQL ולהחליף - -- sql find and replace SQL למצוא ולהחליף - -- mySQL search replace חיפוש mySQL להחליף - -- REPLACE IN MYSQL REPLACE IN MYSQL - -- sql replace string SQL להחליף מחרוזת - -- sql replace function SQL להחליף את הפונקציה - -- mysql replace syntax MySQL להחליף תחביר - -- mysql replace MySQL להחליף - -- find and replace in sql חיפוש והחלפה ב-SQL - -- replace in sql להחליף ב SQL - -- find and replace sql למצוא ולהחליף SQL - -- mysql replace example MySQL להחליף לדוגמה - -- sql string replace מחרוזת SQL להחליף - -- find replace mysql למצוא מחליף MySQL - -- find replace sql למצוא מחליף SQL - -- find and replace mysql למצוא ולהחליף MySQL - -- sql replace mysql SQL להחליף MySQL - -- REPLACE command in sql הפקודה REPLACE ב SQL - -- SQL replace SQL להחליף - -- sql replace syntax SQL להחליף תחביר - -- replace sql command להחליף את פקודת SQL - -- replace text mysql להחליף MySQL טקסט - -- mysql replace command MySQL להחליף את הפקודה - -- mysql text replace טקסט MySQL להחליף - -- find and replace SQL query למצוא ולהחליף שאילתת SQL - -- replace text sql להחליף SQL טקסט - -- MySQL Replace() MySQL החלף () - -- search and replace mysql חיפוש והחלפה MySQL - -- search replace mysql חיפוש להחליף MySQL - -- mysql sql REPLACE REPLACE SQL MySQL - -- mysql search and replace text חיפוש MySQL ולהחליף טקסט - -- mysql find MySQL למצוא - -- string replace mysql מחרוזת להחליף MySQL - -- mysql replace sql MySQL להחליף SQL - -- MySQL REPLACE statement MySQL הצהרה REPLACE - -- sql replace all SQL להחליף את כל - -- all הכל - -- mysql update replace text עדכון MySQL להחליף טקסט - -- REPLACE function sql SQL הפונקציה REPLACE - -- sql + replace SQL + להחליף - -- replace text in mysql ולהחליף טקסט MySQL - -- find replace in sql למצוא מחליף ב SQL - -- mysql replace string function MySQL להחליף את הפונקציה המחרוזת - -- string replace SQL מחרוזת להחליף SQL - -- sql replace examples SQL להחליף דוגמאות - -- replace function in sql להחליף את הפונקציה של SQL - -- sql search replace חיפוש SQL להחליף - -- sql replace example SQL להחליף לדוגמה - -- find and replace in mysql חיפוש והחלפה ב-MySQL - -- sql command replace פקודת SQL להחליף - -- search and replace in mysql חיפוש והחלפה ב-MySQL - -- mysql replace text MySQL להחליף טקסט - -- mysql replace table MySQL להחליף שולחן - -- sql text replace טקסט SQL להחליף - -- replace text in SQL ולהחליף טקסט SQL - -- replace command sql להחליף SQL הפקודה - -- sql replace statement SQL להחליף הצהרה - -- sql find text למצוא טקסט SQL - -- replace string sql להחליף מחרוזת SQL - -- mysql + replace MySQL + להחליף - -- mysql text search and replace חיפוש טקסט MySQL ולהחליף - --