Jan 21 2010

Using REPLACE in an UPDATE statement to fix data on MSSQL and MySQL

Category: MsSQL,MySqlGiulio Pons @ 12:09 am

Sometimes it’s necessary fix data on the database.
I had to fix on a Microsoft database:

      /* MSSQL syntax */
      update table_links set url  = Replace(url, 'www.link.it/web3', 'www.link.it/web') where url <>''

I had to fix on a MySQL database:

      /* MySQL syntax is the same! */
      UPDATE table_links SET url =REPLACE(url, '&amp;', '&') where url<>''

The syntax is the same.

Share

Related posts:

  1. Bot that retrieves url meta data and other infos

Leave a Reply