SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2009
    Location
    Montéal
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    replace with a double quote in the texte

    ok my line :

    Code:
    UPDATE table SET field = replace(field,"<div class='"subtitle"'>","<P>")
    I want to replace
    Code:
    <div class='"subtitle"'> by <p>
    how can I modify the quote in "subtitle" to make the replace work?

    thanks

  2. #2
    SitePοint Troll disgracian's Avatar
    Join Date
    Aug 2006
    Location
    Samsara
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What database are you using?

    Cheers,
    D.

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,245
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Code:
    UPDATE table SET field = 
    REPLACE(field,'<div class=''"subtitle"''>','<P>')
    will work in all databases

    note two consecutive single quotes to represent one is standard SQL escape seqeunce

    even mysql with its funky you-can-use-either-'-or-"-to-delimit-strings and its wacky backslash escape character will execute it successfully
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •