Replace String example SQL

SELECT hno, zip, city, REPLACE (address,\' t.\' ,\' treet\' ) address FROM hotel where address like \'%tr%\'

The above replaces all addresses that contain the text "st." to "street".

This example came from the docs for MaxDB, but I think will work in MySQL and most other SQL database servers as well. I\'ve recently tried it with Access on a linked MS SQL server.

Source:
http://www.mysql.com/documentation/maxdb/71/817392b9b311d2a97100a0c9449261/content.htm

Related Scribbles:
  • MySQL Notes
  • SQL Syntax, Query Examples and Notes


  • ID: 391
    Author:
    leonard
    Date Updated:
    2004-07-07 10:52:37
    Date Created:
    2004-01-13 22:50:12

    Edit

    Comments?
     >> Leonard Chan's Homepage  >> Scribble Web  >> Replace String example SQL
    leonard.lotus-land.ca is hosted by Perceptus Solutions Inc.