How to Find and Replace Text in MySQL Database using SQL Làm thế nào để Tìm và Thay thế văn bản trong cơ sở dữ liệu MySQL sử dụng 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). Cơ sở dữ liệu MySQL có một đơn giản, tiện dụng và chức năng REPLACE chuỗi () cho phép dữ liệu bảng với chuỗi kết hợp (from_string) để được thay thế bằng chuỗi mới (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. Điều này rất hữu ích nếu có cần phải tìm kiếm và thay thế một chuỗi văn bản có ảnh hưởng đến nhiều hồ sơ hay các hàng, chẳng hạn như thay đổi tên công ty, postcode, URL hoặc sai chính tả.

The syntax of REPLACE is REPLACE(text_string, from_string, to_string) Cú pháp của REPLACE là REPLACE (text_string, from_string, to_string)

MySQL reference MySQL tham khảo 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 mô tả như là chức năng mà sẽ trả về chuỗi text_string với tất cả các lần xuất hiện của chuỗi from_string thay thế bằng chuỗi to_string, nơi kết hợp là trường hợp-nhạy cảm khi tìm kiếm from_string. text_string can be retrieved from the a field in the database table too. text_string có thể được lấy từ một trường trong bảng cơ sở dữ liệu quá. Most SQL command can be REPLACE() function, especially SELECT and UPDATE manipulation statement. Hầu hết các lệnh SQL có thể được REPLACE () chức năng, đặc biệt là SELECT và UPDATE thao tác tuyên bố.

For example: Ví dụ:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string'); Cập nhật TABLE_NAME đặt FIELD_NAME = thay thế (FIELD_NAME, 'tìm thấy chuỗi này', 'thay thế hàng chuỗi với chuỗi này');

update client_table set company_name = replace(company_name, 'Old Company', 'New Company') Cập nhật company_name đặt client_table = thay thế (company_name, 'Old ty', 'Công ty mới')

The above statement will replace all instances of 'Old Company' to 'New Company' in the field of company_name of client_table table. Những tuyên bố trên đây sẽ thay thế tất cả các trường hợp 'Old ty' thành 'Công ty mới' trong lĩnh vực company_name của bảng client_table.

Another example: Một ví dụ khác:

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

Above statement will return 'WwWwWw.mysql.com' as result. Ở trên tuyên bố sẽ trở lại 'WwWwWw.mysql.com' như là kết quả.

IMPORTANT : The page is machine translated and provided "as is" without warranty. Quan trọng: Sửa là máy dịch và cung cấp "như là" không có bảo hành. Machine translation may be difficult to understand. Máy dịch thuật có thể khó hiểu. Please refer to Vui lòng tham khảo original English article bản gốc tiếng Anh bài viết whenever possible. bất cứ khi nào có thể.


26 Responses to “How to Find and Replace Text in MySQL Database using SQL” 26 Responses to "Làm thế nào để Tìm và Thay thế văn bản trong cơ sở dữ liệu MySQL sử dụng SQL"

Pages: [2] Trang: [2] 1 1 » » Show All Hiển thị tất cả

  1. vishwas vishwas
    September 30th, 2009 15:26 30 Tháng chín 2009 15:26
    26 26

    Wanted to use REPLACE command to use for a column of a table…and this helped me…thanks Muốn sử dụng lệnh REPLACE để sử dụng cho một cột của một bảng ... và điều này đã giúp tôi ... nhờ

Pages: [2] Trang: [2] 1 1 » » Show All Hiển thị tất cả

Leave a Reply Để lại một trả lời

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> Bạn có thể sử dụng các thẻ: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q <strike> <strong>

Subscribe to comments feature has been disabled. Thuê bao với ý kiến đều đã bị vô hiệu hoá. To receive notification of latest comments posted, subscribe to Để nhận được thông báo mới nhất đăng ý kiến, đăng ký với My Digital Life Comments RSS feed My Digital Life kiến RSS feed or hoặc register to receive đăng ký để nhận được new comments in daily email digest. Các ý kiến mới trong email tiêu hàng ngày.
Custom Search

New Articles Bài viết mới

Incoming Search Terms for the Article Tìm đến các Điều khoản Điều

mysql replace mysql thay thế - -- sql replace sql thay thế - -- replace mysql thay thế mysql - -- mysql find and replace mysql tìm và thay thế - -- sql replace command sql thay thế lệnh - -- Mysql find replace Mysql tìm thay thế - -- sql find replace sql tìm thay thế - -- mysql string replace mysql chuỗi thay thế - -- mysql replace string mysql thay thế chuỗi - -- mysql replace text mysql thay thế văn bản - -- SQL replace text SQL thay thế văn bản - -- REPLACE SQL REPLACE SQL - -- MySQL replace function MySQL thay thế chức năng - -- sql search and replace sql tìm kiếm và thay thế - -- mysql search and replace mysql tìm và thay - -- sql find and replace sql tìm và thay thế - -- mySQL search replace mySQL tìm kiếm thay thế - -- REPLACE IN MYSQL THAY THẾ TRONG MYSQL - -- sql replace string sql thay thế chuỗi - -- sql replace function sql thay thế chức năng - -- mysql replace syntax mysql cú pháp thay thế - -- mysql replace mysql thay thế - -- find and replace in sql tìm và thay thế trong sql - -- replace in sql thay thế trong sql - -- find and replace sql tìm và thay thế sql - -- mysql replace example mysql thay thế ví dụ - -- sql string replace sql chuỗi thay thế - -- find replace mysql tìm thay thế mysql - -- find replace sql tìm thay thế sql - -- find and replace mysql tìm và thay thế mysql - -- sql replace mysql sql thay thế mysql - -- REPLACE command in sql REPLACE lệnh trong sql - -- SQL replace SQL thay thế - -- sql replace syntax sql cú pháp thay thế - -- replace sql command thay thế lệnh sql - -- replace text mysql mysql thay thế văn bản - -- mysql replace command mysql thay thế lệnh - -- mysql text replace mysql văn bản thay thế - -- find and replace SQL query tìm và thay thế truy vấn SQL - -- replace text sql sql thay thế văn bản - -- MySQL Replace() MySQL Thay thế () - -- search and replace mysql tìm kiếm và thay thế mysql - -- search replace mysql tìm kiếm thay thế mysql - -- mysql sql REPLACE mysql sql THAY THẾ - -- mysql search and replace text mysql tìm kiếm và thay thế văn bản - -- mysql find mysql tìm - -- string replace mysql chuỗi thay thế mysql - -- mysql replace sql mysql thay thế sql - -- MySQL REPLACE statement MySQL REPLACE cáo - -- sql replace all sql thay thế tất cả - -- all tất cả - -- mysql update replace text mysql cập nhật thay thế văn bản - -- REPLACE function sql REPLACE chức năng sql - -- sql + replace sql + thay thế - -- replace text in mysql thay thế văn bản trong mysql - -- find replace in sql tìm thay thế trong sql - -- mysql replace string function mysql chức năng thay thế chuỗi - -- string replace SQL chuỗi thay thế SQL - -- sql replace examples sql thay thế các ví dụ - -- replace function in sql thay thế chức năng trong sql - -- sql search replace sql tìm kiếm thay thế - -- sql replace example sql thay thế ví dụ - -- find and replace in mysql tìm và thay thế trong mysql - -- sql command replace sql lệnh thay thế - -- search and replace in mysql tìm kiếm và thay thế trong mysql - -- mysql replace text mysql thay thế văn bản - -- mysql replace table mysql thay thế bảng - -- sql text replace sql văn bản thay thế - -- replace text in SQL thay thế văn bản trong SQL - -- replace command sql thay thế sql lệnh - -- sql replace statement sql thay thế tuyên bố - -- sql find text sql tìm văn bản - -- replace string sql thay thế sql string - -- mysql + replace mysql + thay thế - -- mysql text search and replace mysql văn bản tìm kiếm và thay thế - --