MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2012, 08:34 AM
leozx9r leozx9r is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 3 leozx9r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 28 sec
Reputation Power: 0
What symbol to use instead?

Hello Guys,
I hope I can make sense and get an answer..
I'm trying to update a field on a table..
This field contains different forwarding methods for a message.
For Example: EIioT which stands for Email Immediately incoming outgoing T (not sure)
If I want to change for only incoming I can change it to: EIiT but this way, if the first letter was S (for SMS) will default all to E (email).
How can I just modify/add/remove a letter in the middle without effecting others?
I tried * and ?..

Hope yopu can help..

Regards to all

Reply With Quote
  #2  
Old October 19th, 2012, 10:42 AM
sr sr is offline
Problem Solver
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2001
Location: Stockholm, Sweden
Posts: 4,430 sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 7 h 23 m 50 sec
Reputation Power: 532
String Replace():
Code:
UPDATE ...
SET
  yourColumn = REPLACE(yourColumn, 'x', 'y')
WHERE
  yourColumn LIKE '%x%'


The WHERE LIKE is to explicitly choose the rows that need to be updated.
__________________
/Stefan

Reply With Quote
  #3  
Old October 22nd, 2012, 05:09 AM
leozx9r leozx9r is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 3 leozx9r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 28 sec
Reputation Power: 0
Thank you Stephan..

can't get it though..

I used:

Set FORWARD_DETAILS = '%IioT'

out of all the above letters I want only the first not to be touched...

do I need the % sign at the end too?

Reply With Quote
  #4  
Old October 22nd, 2012, 05:18 AM
leozx9r leozx9r is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 3 leozx9r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 28 sec
Reputation Power: 0
This is what I wrote:

update MESSAGE_ACTIONS
SET
FORWARD_DETAILS = REPLACE ( FORWARD_DETAILS ' i ' , ' io ' )
WHERE
FORWARD_DETAILS LIKE ' %i% '

not working

Reply With Quote
  #5  
Old October 22nd, 2012, 07:25 AM
sr sr is offline
Problem Solver
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2001
Location: Stockholm, Sweden
Posts: 4,430 sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 7 h 23 m 50 sec
Reputation Power: 532
And what is the error message that you get?

Could it be:
Code:
mysql> update MESSAGE_ACTIONS
    -> SET
    -> FORWARD_DETAILS = REPLACE ( FORWARD_DETAILS ' i ' , ' io ' )
    -> WHERE
    -> FORWARD_DETAILS LIKE ' %i% ';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL serv
er version for the right syntax to use near '' i ' , ' io ' )
WHERE
FORWARD_DETAILS LIKE ' %i% '' at line 3

And by looking and stepping through this code I can see that:
1. You don't have a comma between the column name FORWARD_DETAILS and the 'i'.
2. You have spaces between the ' sign and the letter i and the letters io, which means that mysql is right now trying to replace the string '(space)i(space)' with the string '(space)io(space).
3. You have spaces inside the string in LIKE also.

So try this instead:
Code:
update MESSAGE_ACTIONS
SET
FORWARD_DETAILS = REPLACE ( FORWARD_DETAILS, 'i' , 'io' )
WHERE
FORWARD_DETAILS LIKE '%i%'

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > What symbol to use instead?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap