Delete until end of line

Discussion in 'ASP General' started by Joey Martin, Apr 19, 2007.

  1. Joey Martin

    Joey Martin Guest

    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 ***
     
    Joey Martin, Apr 19, 2007
    #1
    1. Advertising

  2. Joey Martin

    Subrato Guest

    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 ..
     
    Subrato, Apr 19, 2007
    #2
    1. Advertising

  3. 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.
     
    Bob Barrows [MVP], Apr 19, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sjaakie
    Replies:
    4
    Views:
    471
    Sjaakie
    Mar 22, 2005
  2. RicK
    Replies:
    2
    Views:
    375
  3. Replies:
    2
    Views:
    312
    Joshua Cranmer
    Sep 5, 2007
  4. Alexzive

    writing on file not until the end

    Alexzive, May 24, 2009, in forum: Python
    Replies:
    8
    Views:
    412
    Dave Angel
    May 25, 2009
  5. Guest
    Replies:
    4
    Views:
    301
    Guest
    May 12, 2006
Loading...

Share This Page