how do you use wild card in select statements

Results 1 to 6 of 6

Thread: how do you use wild card in select statements

  1. #1
    Join Date
    Dec 1969
    Posts
    83

    Default how do you use wild card in select statements

    suppose i want to use wild cards how do you do this in asp select statements <BR><BR>this is my present statement<BR><BR>strsql="SELECT * from qrydoctors where pinnumber=&#039;"& varcookie &"&#039; and phylastname=&#039;"&formsearch&"&#039;"<BR><BR>the one i want to use wild card on is phylastname<BR><BR>

  2. #2
    Join Date
    Dec 1969
    Location
    Indianapolis, IN
    Posts
    1,755

    Default What DBMS?

    If SQL Server:<BR>strsql="SELECT * from qrydoctors where pinnumber LIKE &#039;%&#039; and phylastname=&#039;"&formsearch&"&#039;"<BR><BR>LIK E with the &#039;%&#039; means phylastname can be anything. If you were to use &#039;TO%&#039;, phylastname would have to begin with TO. If you were to use &#039;%LY&#039;, phylastname would have to end in LY. Is that kind of what you&#039;re asking for? I wasn&#039;t quite sure.

  3. #3
    Join Date
    Dec 1969
    Posts
    83

    Default RE: What DBMS?

    MS access

  4. #4
    Join Date
    Dec 1969
    Posts
    96,118

    Default I don't known why DB would matter...

    ODBC and .NET providers all use the same wildcard: %<BR><BR>So:<BR><BR>strsql="SELECT * from qrydoctors " _<BR> & " WHERE pinnumber=&#039;" & varcookie & "&#039; AND phylastname LIKE &#039;%" & formsearch & "%&#039;" <BR><BR>


  5. #5
    Join Date
    Dec 1969
    Location
    Indianapolis, IN
    Posts
    1,755

    Default I thought...

    Access used * as the wildcard.

  6. #6
    Join Date
    Dec 1969
    Posts
    96,118

    Default Not from ADO or ADO.NET...

    That&#039;s only when you are using Access "standalone".<BR><BR>Via either ODBC or the JET driver, it matches the ANSI standard.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •