If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > using characters such as < and " in a query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-13-11, 20:20
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
Question using characters such as < and " in a query

Hello,
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?
TIA!

Last edited by Leafgreen; 01-14-11 at 03:27.
Reply With Quote
  #2 (permalink)  
Old 01-13-11, 22:18
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,535
Quote:
Originally Posted by Leafgreen View Post
Is that the correct syntax?
what happened when you tested it?

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-14-11, 03:34
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
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.
Reply With Quote
  #4 (permalink)  
Old 01-14-11, 15:44
sqlfan sqlfan is offline
Registered User
 
Join Date: Jul 2010
Posts: 7
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On