How to Find and Replace Text in MySQL Database using 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). قاعدة بيانات الخلية له مفيد ويستعاض عن وظيفة بسيطة الخيط ((ان يسمح الجدول مطابقه البيانات مع الخيط (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) النحو هو من يحل محل يحل محل (text_string ، from_string ، to_string)
MySQL reference اشارة الخلية 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. ويصف تحل محل وظيفة كما ان العودة الخيط 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. لغة الاستعلامات البنيويه معظم القيادة يمكن ان تحل محل () وظيفة ، ولا سيما تحديث اختر والتلاعب.
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’) تحديث client_table تحل محل مجموعة company_name = (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’); اختر تحل محل ( 'www.mysql.com' ، 'ث' ، 'ث ث') ؛
Above statement will return ‘WwWwWw.mysql.com’ as result. البيان المشار اليه اعلاه سوف يعود 'wwwwww.mysql.com' نتيجة.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. هام : هذا هو الاله الذي ترجم صفحة مقدمة "كما هى" دون ضمان. Machine translation may be difficult to understand. الترجمة الاليه قد يكون من الصعب ان نفهم. Please refer to يرجى الرجوع الى original English article المادة الاصليه English whenever possible. كلما كان ذلك ممكنا.
Share and contribute or get technical support and help at والمساهمة في حصة او الحصول على الدعم التقني والمساعدة فى My Digital Life Forums بلدي الرقميه الحياة المنتديات .
Related Articles مقالات ذات صلة
- How to Move WordPress Blog to New Domain or Location كيفية التحرك لبلوق WordPress نطاق جديد او موقع
- Remove or Trim First or Last Few Characters in MySQL Database with SQL ازالة او تقليم او القليلة الماضية أول حرف في الخلية قاعدة البيانات مع لغة الاستعلامات البنيويه
- Change or Set MySQL Long Query Time Value for log-slow-queries تغيير الخلية او مجموعة طويلة وقت الاستعلام عن قيمة الدخول بطيء الاستفسارات
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial كيفية النسخ الاحتياطي واستعادة (الصادرات والواردات) الخلية قواعد البيانات الدورة التعليميه
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database تمكن من قطع الاشجار بطيءه الاستفسارات (بطيءه سجل استفسار) في قاعدة بيانات الخلية
- WordPress MySQL SQL Query Error in WPDB Class WordPress الخلية لغة الاستعلامات البنيويه استفسار خطأ في الدرجة wpdb
- MySQL Database Performance Tuning Best Practices Video Tutorial قاعدة بيانات الخلية ضبط اداء افضل الممارسات الدورة التعليميه الفيديو
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 تثبيت خادم الويب في ويندوز اكس بي مع apache2 ، php5 وmysql4 -- الجزء 4
- Change and Reset MySQL root Password تغيير الخلية الجذريه واعادة ضبط كلمة السر
- MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length خطأ في الخلية 1170 (42000) : النقطه (نص العمود الرئيسية المستخدمة في تحديد بدون طول المفتاح

































May 4th, 2007 05:48 الرابع من ايار / مايو ، 2007 05:48
Thanks a lot! شكرا جزيلا! You’ve saved my life! لقد انقذ حياتي!
May 11th, 2007 10:38 الحاديه عشرة ايار / مايو ، 2007 10:38
Thanks for the help! شكرا للمساعدة!
May 16th, 2007 07:24 ايار / مايو 16th ، 2007 07:24
Excellent, just what I needed. ممتاز ، وانا بحاجة فقط الى ما يتطلع اليه. Thanks! شكرا!
October 1st, 2007 18:23 تشرين الاول / اكتوبر 1st ، 2007 18:23
[...] The guide uses SQL statements based on MySQL replace() function to modify the database. [...]يستخدم الدليل لغة الاستعلامات البنيويه البيانات بناء على استبدال الخلية () وظيفة لتعديل قاعدة البيانات. To run SQL queries, login to MySQL database that houses WordPress tables [...] الاستفسارات لتشغيل لغة الاستعلامات البنيويه ، ادخل الى الخلية قاعدة البيانات ان المنازل WordPress الجداول [...]
June 4th, 2008 15:43 الرابع من حزيران ، 2008 15:43
thanks, this is very helpful!! شكرا ، وهذا مفيد جدا!
September 1st, 2008 01:48 الاول من ايلول ، 2008 01:48
[...] The guide uses SQL statements based on MySQL replace() function to modify the database. [...]يستخدم الدليل لغة الاستعلامات البنيويه البيانات بناء على استبدال الخلية () وظيفة لتعديل قاعدة البيانات. To run SQL queries, login to MySQL database that houses WordPress tables [...] الاستفسارات لتشغيل لغة الاستعلامات البنيويه ، ادخل الى الخلية قاعدة البيانات ان المنازل WordPress الجداول [...]
September 10th, 2008 21:52 العاشر من ايلول / سبتمبر ، 2008 21:52
Algo k es puede resultar practico es cuando se necesita eliminar un caracter de una sere de registros es: ك ا ط algo puede resultar practico داط cuando necesita سي ان يزيل من الامم المتحدة caracter دي دي اونا احرق registros ت :
update tabla1 set campo1=replace(campo1,’8′,”); تحديث tabla1 تحل محل مجموعة campo1 = (campo1 ، '8'،")؛
esta sentencia eliminaria todos los 8 de la tabla: tabla1 del registro: campo1 esta sentencia eliminaria لجميع الناس 8 لوس دي مدينة لوس انجلوس tabla : tabla1 دل Registro : campo1
(NOTA: las comillas son todas simples). (ملاحظه : comillas ابن لاس todas عامة).