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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. String search problem in SQL Server

String search problem in SQL Server

Scheduled Pinned Locked Moved Database
databasesql-serversysadminalgorithmshelp
5 Posts 3 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.
  • H Offline
    H Offline
    hvgyufg28fh38tyr78hf
    wrote on last edited by
    #1

    Hai all, I am searching one string (ex.Hello-Welcome) in text file using SQL query. its searching Hello and Welcome seperatly and giving a result , i think bcoz hyphen(-) is a word breaker in SQL .can any one give me the idea how to resolve the problem. i need to use hyphen in searching string, and i need a combined string search result. how to form the query?, if any one have sample pls send me. thanks mahe

    N T 2 Replies Last reply
    0
    • H hvgyufg28fh38tyr78hf

      Hai all, I am searching one string (ex.Hello-Welcome) in text file using SQL query. its searching Hello and Welcome seperatly and giving a result , i think bcoz hyphen(-) is a word breaker in SQL .can any one give me the idea how to resolve the problem. i need to use hyphen in searching string, and i need a combined string search result. how to form the query?, if any one have sample pls send me. thanks mahe

      N Offline
      N Offline
      Niladri_Biswas
      wrote on last edited by
      #2

      Let me know if u r not looking for this -

      declare @t table(record varchar(100))
      insert into @t
      select 'Hello-World' union all
      select 'code - project codes are good' union all
      select 'hello' union all
      select ' world' union all
      select ' how are u-?'

      Query

      select * from @t where record like '%[-]%'

      Output:

      record
      Hello-World
      code - project codes are good
      how are u-?

      :)

      Niladri Biswas

      modified on Tuesday, December 1, 2009 8:12 AM

      H 1 Reply Last reply
      0
      • N Niladri_Biswas

        Let me know if u r not looking for this -

        declare @t table(record varchar(100))
        insert into @t
        select 'Hello-World' union all
        select 'code - project codes are good' union all
        select 'hello' union all
        select ' world' union all
        select ' how are u-?'

        Query

        select * from @t where record like '%[-]%'

        Output:

        record
        Hello-World
        code - project codes are good
        how are u-?

        :)

        Niladri Biswas

        modified on Tuesday, December 1, 2009 8:12 AM

        H Offline
        H Offline
        hvgyufg28fh38tyr78hf
        wrote on last edited by
        #3

        thanks 4 ur reply its like same but i am searching the hyphenated string in text file. if u know any SQL query to searchin the string in any file pls let me know. thanks mahe

        1 Reply Last reply
        0
        • H hvgyufg28fh38tyr78hf

          Hai all, I am searching one string (ex.Hello-Welcome) in text file using SQL query. its searching Hello and Welcome seperatly and giving a result , i think bcoz hyphen(-) is a word breaker in SQL .can any one give me the idea how to resolve the problem. i need to use hyphen in searching string, and i need a combined string search result. how to form the query?, if any one have sample pls send me. thanks mahe

          T Offline
          T Offline
          The Man from U N C L E
          wrote on last edited by
          #4

          How are your searching? Using Like, or some varieant of FullText searching?

          If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

          H 1 Reply Last reply
          0
          • T The Man from U N C L E

            How are your searching? Using Like, or some varieant of FullText searching?

            If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

            H Offline
            H Offline
            hvgyufg28fh38tyr78hf
            wrote on last edited by
            #5

            i am searchin with CONTAINS keyword.

            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