DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Query with a dash

  1. #1
    Chris Jantze Guest

    Query with a dash


    I need to perform a query on a field that contains any number of dashes in
    it. SQL is defaulting to using it as a range so my query is returning an
    empty set. Is there a way around this?
    Thanks for any help.

    ex:
    SELECT * FROM [Patients] WHERE Chart LIKE '0-00*';"


  2. #2
    Roy Guest

    Re: Query with a dash


    "Chris Jantze" <tech@addison.attbbs.com> wrote:
    >
    >I need to perform a query on a field that contains any number of dashes

    in
    >it. SQL is defaulting to using it as a range so my query is returning an
    >empty set. Is there a way around this?
    >Thanks for any help.
    >
    >ex:
    >SELECT * FROM [Patients] WHERE Chart LIKE '0-00*';"
    >

    If you using VB6 then Replace function could be very usefull:

    val=Trim(Text1.Text)
    val = Replace(fld1, "-", "*", 1, , vbTextCompare)
    Sql= SELECT * FROM [Patients] WHERE Chart LIKE " & "'" & fld1 & "'"

    Hope this helps.
    Regards, Roy


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