SQL search statement


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: SQL search statement

  1. #1
    David M Guest

    SQL search statement


    I am in the middle of creating a database search page for a web site...

    I was wondering if an *(asterix) can be used as part of the LIKE section

    i.e.

    SELECT description, url, title FROM tblURL WHERE description =
    * & txtsearchstring & *

    would this filter out the selected fields that has the search string in the
    "descrition" field....

    any help would be appreciated

    David M


  2. #2
    Matt Guest

    Re: SQL search statement


    I would suggest using the 'like' operand in your SQL statement:
    SELECT description, url, title FROM tblURL WHERE description like
    % & txtsearchstring & %

    HTH ... Matt


    "David M" <d_mcgillivray@lineone.net> wrote:
    >
    >I am in the middle of creating a database search page for a web site...
    >
    >I was wondering if an *(asterix) can be used as part of the LIKE section
    >
    >i.e.
    >
    >SELECT description, url, title FROM tblURL WHERE description =
    >* & txtsearchstring & *
    >
    >would this filter out the selected fields that has the search string in

    the
    >"descrition" field....
    >
    >any help would be appreciated
    >
    >David M
    >



  3. #3
    L. Howell Guest

    Re: SQL search statement


    "David M" <d_mcgillivray@lineone.net> wrote:
    >
    >I am in the middle of creating a database search page for a web site...
    >
    >I was wondering if an *(asterix) can be used as part of the LIKE section
    >
    >i.e.
    >
    >SELECT description, url, title FROM tblURL WHERE description =
    >* & txtsearchstring & *
    >
    >would this filter out the selected fields that has the search string in

    the
    >"descrition" field....
    >
    >any help would be appreciated
    >
    >David M
    >


    David,

    Nope, it does not like *'s it prefers % - hope this helps!

    Leonard


  4. #4
    Bill Guest

    Re: SQL search statement


    "David M" <d_mcgillivray@lineone.net> wrote:
    >
    >I am in the middle of creating a database search page for a web site...
    >
    >I was wondering if an *(asterix) can be used as part of the LIKE section
    >
    >i.e.
    >
    >SELECT description, url, title FROM tblURL WHERE description =
    >* & txtsearchstring & *
    >
    >would this filter out the selected fields that has the search string in

    the
    >"descrition" field....
    >
    >any help would be appreciated
    >
    >David M
    >


    I just experienced a similar problem myself. Try using % instead of *

    Bill


  5. #5
    Don Wolthuis Guest

    Re: SQL search statement


    Bill is correct use %

    "Bill" <Bill@neropes.com> wrote:
    >
    >"David M" <d_mcgillivray@lineone.net> wrote:
    >>
    >>I am in the middle of creating a database search page for a web site...
    >>
    >>I was wondering if an *(asterix) can be used as part of the LIKE section
    >>
    >>i.e.
    >>
    >>SELECT description, url, title FROM tblURL WHERE description =
    >>* & txtsearchstring & *
    >>
    >>would this filter out the selected fields that has the search string in

    >the
    >>"descrition" field....
    >>
    >>any help would be appreciated
    >>
    >>David M
    >>

    >
    >I just experienced a similar problem myself. Try using % instead of *
    >
    >Bill
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center