Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008

    Question Unanswered: using characters such as < and " in a query

    I want to replace a string that contains these characters: < > "
    I'm guessing that I can't simply enclose the string between ' and '
    How do I do it?

    For example, I'd like to run this query:
    UPDATE xcart_products
    SET fulldescr = REPLACE(fulldescr,'<param name="movie"','<param name="wmode" value="opaque"> <param name="movie"')

    Is that the correct syntax?
    Last edited by Leafgreen; 01-14-11 at 04:27.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by Leafgreen View Post
    Is that the correct syntax?
    what happened when you tested it? | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2008
    I didn't test then but I did now this way: I located an empty column in the db with the same properties as the column with live data, and added a row with the string: <param name="movie"
    It worked, so I'm confident to run it on the live data. Thank you!
    Actually, I will start doing this simple method to test queries and learn more quickly now! Thank you.

  4. #4
    Join Date
    Jul 2010
    Actually, if you want to test a function, you don't have to create a table, just run the function directly without any column name in it:

    select REPLACE('<param name="movie"','<param name="movie"','<param name="wmode" value="opaque"> <param name="movie"') as r

Posting Permissions

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