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

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
LVL 1
AswAsked:
Who is Participating?
 
atul_parmarCommented:
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
 
atul_parmarCommented:
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
 
AswAuthor Commented:
Hi atul_parmar,

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

Thanks
Andy
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
mikelittlewoodCommented:
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
 
mikelittlewoodCommented:
ah so just have to replace CharIndex with Position in mine, nice.
0
 
AswAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.