Solved

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

Posted on 2006-06-21
6
167 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now