3

I am trying to replace all instances of an IP (stored as a string) in a database with a different IP.

to do this for a known table and column I would run

UPDATE tableName
SET columnName = REPLACE(columnName, ‘IP1/', 'IP2/');

But i need to do this for all columns in all tables, is there an easy way to apply this command to all columns in the DB.

Thanks

HumanTarget
  • 506
  • 2
  • 13
  • 1
    It sounds as though your schema is very broken indeed. – eggyal Apr 24 '13 at 12:09
  • Yeah it isn't the best. But that's not really why we need to do this.The reason why this is being done is because another dev wants to setup a system on a VM and configure everything for the product. And then take that VM and install it in a bunch of different places to demo/train customers with a demo system. But the IP address of the various systems will be different each time he runs this demo system so he needs to be able to quickly change the IPs. It's more of a hack than anything else but if I could do it it would save us a bunch of time. – HumanTarget Apr 24 '13 at 14:09
  • You will get some idea from this: http://stackoverflow.com/questions/3145076/replace-all-fields-in-mysql – Foreever Oct 15 '15 at 05:21

0 Answers0