Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase 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 Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old January 23rd, 2003, 02:31 PM
ccm13 ccm13 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 25 ccm13 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What to use, REPLACE ?

Ok,
here is what I created:
Code:
INSERT INTO test VALUES (1,'M:I:B:AA');
INSERT INTO test VALUES (2,'M:I:B:BB');
INSERT INTO test VALUES (3,'M:I:B:CC');
INSERT INTO test VALUES (4,'M:I:B:DD');
INSERT INTO test VALUES (5,'M:I:B:EE');
INSERT INTO test VALUES (6,'M:I:B:FF');
INSERT INTO test VALUES (7,'M:I:B:GG');
INSERT INTO test VALUES (8,'M:I:B:HH');
.....

The smiley face shouldn't be there in line 4, obviously, it should be : D (without the space).

What I want to do is take out the 5th and 6th characters in all rows in the second column( e.g. B: ) and leave the rest of the data alone. I would like to replace the specific positions(5th and 6th) as I do not know if B: would come up again.

I have tried using various replace statement with no luck. Am I using the right statement? How would I do this?

TIA

Reply With Quote
  #2  
Old January 23rd, 2003, 02:38 PM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: What to use, REPLACE ?

Code:
UPDATE test SET column_name=INSERT(column_name, 5, 2, '')

For more info, see MySQL documentation.

Reply With Quote
  #3  
Old January 23rd, 2003, 02:39 PM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: What to use, REPLACE ?

And be sure to run it only once

Reply With Quote
  #4  
Old January 23rd, 2003, 03:07 PM
ccm13 ccm13 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 25 ccm13 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: What to use, REPLACE ?

Thanks,(smiley face intentional!) worked like a charm.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > What to use, REPLACE ?


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway