Solved

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

Posted on 2006-06-21
6
173 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month4 days, 21 hours left to enroll

635 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