Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL where Clause help needed

SQL where Clause help needed

Scheduled Pinned Locked Moved Database
databasehelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 4417354
    wrote on last edited by
    #1

    Hi Can anyone advise/help me with the following I am trying to Select from table where xfield HAS either (,),/,%, : in the first 3chars For instance, the query should return the row G1: darararararararar and not G12 easfsafsafsfsfsfsfsf Thanks in advance

    B S C 3 Replies Last reply
    0
    • U User 4417354

      Hi Can anyone advise/help me with the following I am trying to Select from table where xfield HAS either (,),/,%, : in the first 3chars For instance, the query should return the row G1: darararararararar and not G12 easfsafsafsfsfsfsfsf Thanks in advance

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Can you explain more your question?


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

      1 Reply Last reply
      0
      • U User 4417354

        Hi Can anyone advise/help me with the following I am trying to Select from table where xfield HAS either (,),/,%, : in the first 3chars For instance, the query should return the row G1: darararararararar and not G12 easfsafsafsfsfsfsfsf Thanks in advance

        S Offline
        S Offline
        Scubapro
        wrote on last edited by
        #3

        You could try this:

        select * from Table
        where (xfield like '[,/%:]%' OR xfield like '_[,/%:]%' OR xfield like '__[,/%:]%')

        1 Reply Last reply
        0
        • U User 4417354

          Hi Can anyone advise/help me with the following I am trying to Select from table where xfield HAS either (,),/,%, : in the first 3chars For instance, the query should return the row G1: darararararararar and not G12 easfsafsafsfsfsfsfsf Thanks in advance

          C Offline
          C Offline
          Chris Meech
          wrote on last edited by
          #4

          How about

          where instr(substr(xfield,1,3),'(') > 0
          or instr(substr(xfield,1,3),')') > 0
          or instr(substr(xfield,1,3),'/') > 0
          or instr(substr(xfield,1,3),'%') > 0
          or instr(substr(xfield,1,3),':') > 0

          Can't remember if the % or : character need to be escaped. :)

          Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups