Delete until end of line

J

Joey Martin

Sample:
sql="select * from table order by id"

How do I look at the query statement and remove all the characters
starting with "order by" and remove all remaining characters in that
line?
 
S

Subrato

Sample:
sql="select * from table order by id"

How do I look at the query statement and remove all the characters
starting with "order by" and remove all remaining characters in that
line?

*** Sent via Developersdexhttp://www.developersdex.com***

You could do a string search and remove everything after the word
order till you encounter the last double quote ..
 
B

Bob Barrows [MVP]

Joey said:
Sample:
sql="select * from table order by id"

How do I look at the query statement and remove all the characters
starting with "order by" and remove all remaining characters in that
line?
Two techniques:
1. InStr() combined with Left()

sql=Left(sql, InStr(sql,"order by") - 1)

2. Regular Expression
left as exercise for other posters
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top