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. Need a Select query that filter illegal characters

Need a Select query that filter illegal characters

Scheduled Pinned Locked Moved Database
databasetutorialquestion
3 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.
  • N Offline
    N Offline
    nainakarri
    wrote on last edited by
    #1

    Hi All I am having sqlserver 2008R2 database, and in the table, there is a column "Text" with some string value. Some of the strings are good (have the characters entered from keyboard" where some have values like "degree" symbol. example:

    Row 1 has string "Today temperature is 45Degrees C" where as Row 2 has string "Today temperature is 40°C

    Row 2 has a symbol which is not entered through the keyboard. I want to filter such kind of symbols while querying. Is there a way to query that way by filtering? If so, please provide me such query. Thanks in advance, Usha

    Naina

    L U 2 Replies Last reply
    0
    • N nainakarri

      Hi All I am having sqlserver 2008R2 database, and in the table, there is a column "Text" with some string value. Some of the strings are good (have the characters entered from keyboard" where some have values like "degree" symbol. example:

      Row 1 has string "Today temperature is 45Degrees C" where as Row 2 has string "Today temperature is 40°C

      Row 2 has a symbol which is not entered through the keyboard. I want to filter such kind of symbols while querying. Is there a way to query that way by filtering? If so, please provide me such query. Thanks in advance, Usha

      Naina

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      That'd be rather slow; but you could loop through all chars, see if it falls within an expected range (say, ASCII upto 127), put that in a function, and call that from the query.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      1 Reply Last reply
      0
      • N nainakarri

        Hi All I am having sqlserver 2008R2 database, and in the table, there is a column "Text" with some string value. Some of the strings are good (have the characters entered from keyboard" where some have values like "degree" symbol. example:

        Row 1 has string "Today temperature is 45Degrees C" where as Row 2 has string "Today temperature is 40°C

        Row 2 has a symbol which is not entered through the keyboard. I want to filter such kind of symbols while querying. Is there a way to query that way by filtering? If so, please provide me such query. Thanks in advance, Usha

        Naina

        U Offline
        U Offline
        Umer Akram
        wrote on last edited by
        #3

        There are multiple ways to do it. i would suggest you should review your data to identify how many other invalid characters you have after this just use the simple REPLACE() function to remove those. Furthermore, if you are planing to create a function for this then you can look into this Link. hope it helps.

        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