Solved

How do I delete all the text from a database field up to a ?

Posted on 2006-06-21
6
172 Views
Last Modified: 2010-04-05
Hi,

I have a field called description in a database table, within the field is a ?, I want to delete all the text up to the ? and leave the rest.

Help needed.

Many thanks
Asw
0
Comment
Question by:Asw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 10

Expert Comment

by:atul_parmar
ID: 16950731
This will work for Access.

update tablename
set description = mid(description, instr(description, "?")+1)

If you are using other database just replace the mid and instr function with similar one.
0
 
LVL 1

Author Comment

by:Asw
ID: 16950941
Hi atul_parmar,

I'm using DBIsam, but I'll give it a try.

Thanks
Andy
0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 16951061
I think the MSSQL version would be something like this if you have similar

UPDATE tablename
SET description = SubString(description, CharIndex('?', description) +1, Len(description))
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
atul_parmar earned 125 total points
ID: 16951100
For DBIsam,
UPDATE tablename
SET description = SubString(description, POSITION('?', description) +1, Length(description))
for SQL referance see http://www.elevatesoft.com/dbisam4d5_sql_reference.htm
0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 16951233
ah so just have to replace CharIndex with Position in mine, nice.
0
 
LVL 1

Author Comment

by:Asw
ID: 16951583
Hi Guyz,

Thanks for putting me in the correct direction.

I'll give the points to atul_parmar, because I got the info from http://www.elevatesoft.com/dbisam4d5_sql_reference.htm

This does the trick:
UPDATE Products
SET description = SubString(description from POS('?' in description)
+1)

Thanks
Andy
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question