Blog | tag: MySQL
Back to: Geek Stuff
Monday, 14. december 2009.

MySQL Find and Replace with helper tool that generates SQL for you

How to find and replace text in MySql with an online tool that generates SQL for you.

So this is the SQL for replacing some text in MySQL database:

update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');

So if you had a table named "documents" in your database where you wanted to go trough content and replace all absolute URL's with relative ones, you would have something like this:

update documents set content = replace(content, 'http://www.yourwebsite.com/','/');

And now that we went trough the boring stuff, here is something to make it a bit easier.

ttest

P.S. The image in header is made by my girlfriends and mine fingers (except for the MySql text which was added in Photoshop) on the iPhone with Brushes app

Comment

Fresh One

Photo

Nature, Up Close & Personal

  • 5.00
    • 1
    • 2
    • 3
    • 4
    • 5
(current rating: 5.00 | 1 votes)
Calendar

January 2010

  • mon
  • tue
  • wed
  • thu
  • fri
  • sat
  • sun
  •  
  •  
  •  
  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

December 2009

  • mon
  • tue
  • wed
  • thu
  • fri
  • sat
  • sun
  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

May 2009

  • mon
  • tue
  • wed
  • thu
  • fri
  • sat
  • sun
  •  
  •  
  •  
  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31