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データベースには、便利な機能と単純な文字列に置き換え( )テーブルのデータを、対応することができる文字列( 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.これは便利な場合には必要なテキスト文字列を検索して置換するに多くのレコードまたは行の数に影響を与えるなど、変更の会社名、郵便番号、 URLやスペルの間違いです。
The syntax of REPLACE is REPLACE(text_string, from_string, to_string)代わる代わるの構文は( 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.説明の文字列を返す関数を置き換える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コマンドを置き換える( )関数は、特に操作ステートメントを更新プログラムを選択してください。
For example:例えば:
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);更新プログラムのインデックスに設定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オリジナルの英語記事索引 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トリム削除したり、最初または最後の数文字をMySQLデータベースをSQL
- Change or Set MySQL Long Query Time Value for log-slow-queries MySQLの長いクエリを変更または時間の値を設定することもできます。クエリが遅い
- How to Backup and Restore (Export and Import) MySQL Databases Tutorialどのようにバックアップと復元(エクスポートおよびインポート) MySQLデータベースのチュートリアル
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Databaseログを有効に遅いクエリ(スロークエリログ)にMySQLのデータベースの
- WordPress MySQL SQL Query Error in WPDB Class WordPressのMySQLのSQLクエリにエラーが発生wpdbクラス
- MySQL Database Performance Tuning Best Practices Video Tutorial MySQLデータベースのパフォーマンスチューニングのベストプラクティスのビデオチュートリアル
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4ウェブサーバーでは、 Windows XPをインストールするのApache2 、 PHP5とmysql4 -パート4
- Change and Reset MySQL root Password MySQLのrootのパスワードを変更し、リセット
- MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length MySQLのエラーが発生1170 ( 42000 ) :のBLOB /テキスト列で使用されキー仕様なしでキーの長さ

































May 4th, 2007 05:48 2007年5月4日05:48
Thanks a lot!どうもありがとう! You’ve saved my life!保存したら私の人生!
May 11th, 2007 10:38 2007年5月11日10:38
Thanks for the help!助けてくれてありがとう!
May 16th, 2007 07:24 2007年5月16日07:24
Excellent, just what I needed.素晴らしい、まさに私が欲しかったものです。 Thanks!ありがとう!
October 1st, 2007 18:23 2007年10月1日18:23
[...] The guide uses SQL statements based on MySQL replace() function to modify the database. [...]のガイドに基づいてMySQLのSQLステートメントを使用して置換( )関数を変更するにします。 To run SQL queries, login to MySQL database that houses WordPress tables [...] SQLクエリを実行する、 MySQLデータベースにログインしてWordPressのテーブルが格納さ[...]
June 4th, 2008 15:43 2008年6月4日15:43
thanks, this is very helpful!!ありがとう、これは非常に助かるよ! !
September 1st, 2008 01:48 2008年9月1日01:48
[...] The guide uses SQL statements based on MySQL replace() function to modify the database. [...]のガイドに基づいてMySQLのSQLステートメントを使用して置換( )関数を変更するにします。 To run SQL queries, login to MySQL database that houses WordPress tables [...] SQLクエリを実行する、 MySQLデータベースにログインしてWordPressのテーブルが格納さ[...]
September 10th, 2008 21:52 2008年9月10日21:52
Algo k es puede resultar practico es cuando se necesita eliminar un caracter de una sere de registros es:アルゴリズムkはpuede resultar practicoはcuando se necesita削除国連caracterデuna干からびたデ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このsentencia eliminariaすべてのロス8デラタブラ: tabla1デル申込み: campo1
(NOTA: las comillas son todas simples). (注:ラスコミージャスの息子todasするだけで済みます) 。