Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Delete until end of line (http://www.velocityreviews.com/forums/t803065-delete-until-end-of-line.html)

Joey Martin 04-19-2007 11:53 AM

Delete until end of line
 
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 ***

Subrato 04-19-2007 02:36 PM

Re: Delete until end of line
 
On Apr 19, 7:53 am, Joey Martin <j...@kytechs.com> 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 ..



Bob Barrows [MVP] 04-19-2007 02:47 PM

Re: Delete until end of line
 
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.




All times are GMT. The time now is 07:25 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.