Delete until end of line

Delete until end of line

am 19.04.2007 13:53:10 von 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?





*** Sent via Developersdex http://www.developersdex.com ***

Re: Delete until end of line

am 19.04.2007 16:36:51 von mukherjeesubrato

On Apr 19, 7:53 am, Joey Martin wrote:
> 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 ..

Re: Delete until end of line

am 19.04.2007 16:47:28 von reb01501

Joey Martin wrote:
> 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

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.