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. Simple way to search for all special characters in all fields?

Simple way to search for all special characters in all fields?

Scheduled Pinned Locked Moved Database
databasequestiondiscussion
3 Posts 2 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.
  • R Offline
    R Offline
    Rafferty Uy
    wrote on last edited by
    #1

    Hi, I want to find out if there are special characters in the text fields values of my database. Is there a simple way to do this? My current thoughts is using the complicated way of

    SELECT * FROM MyTable
    WHERE Col_Name LIKE '%~%' OR Col_Description LIKE '%~%'
    OR Col_Name LIKE '%`%' OR Col_Description LIKE '%`%'
    OR Col_Name LIKE '%!%' OR Col_Description LIKE '%!%'
    OR Col_Name LIKE '%@%' OR Col_Description LIKE '%@%'
    ...

    SELECT * FROM MyOtherTable
    WHERE OtherCol_Name LIKE '%~%' OR OtherCol_Description LIKE '%~%'
    OR OtherCol_Name LIKE '%`%' OR OtherCol_Description LIKE '%`%'
    OR OtherCol_Name LIKE '%!%' OR OtherCol_Description LIKE '%!%'
    OR OtherCol_Name LIKE '%@%' OR OtherCol_Description LIKE '%@%'
    ...

    But maybe there's an easier way? Thank you in advance.

    Rafferty

    R E 2 Replies Last reply
    0
    • R Rafferty Uy

      Hi, I want to find out if there are special characters in the text fields values of my database. Is there a simple way to do this? My current thoughts is using the complicated way of

      SELECT * FROM MyTable
      WHERE Col_Name LIKE '%~%' OR Col_Description LIKE '%~%'
      OR Col_Name LIKE '%`%' OR Col_Description LIKE '%`%'
      OR Col_Name LIKE '%!%' OR Col_Description LIKE '%!%'
      OR Col_Name LIKE '%@%' OR Col_Description LIKE '%@%'
      ...

      SELECT * FROM MyOtherTable
      WHERE OtherCol_Name LIKE '%~%' OR OtherCol_Description LIKE '%~%'
      OR OtherCol_Name LIKE '%`%' OR OtherCol_Description LIKE '%`%'
      OR OtherCol_Name LIKE '%!%' OR OtherCol_Description LIKE '%!%'
      OR OtherCol_Name LIKE '%@%' OR OtherCol_Description LIKE '%@%'
      ...

      But maybe there's an easier way? Thank you in advance.

      Rafferty

      R Offline
      R Offline
      Rafferty Uy
      wrote on last edited by
      #2

      By special characters, I meant all characters that are not alpha-numeric. Thank you again.

      Rafferty

      1 Reply Last reply
      0
      • R Rafferty Uy

        Hi, I want to find out if there are special characters in the text fields values of my database. Is there a simple way to do this? My current thoughts is using the complicated way of

        SELECT * FROM MyTable
        WHERE Col_Name LIKE '%~%' OR Col_Description LIKE '%~%'
        OR Col_Name LIKE '%`%' OR Col_Description LIKE '%`%'
        OR Col_Name LIKE '%!%' OR Col_Description LIKE '%!%'
        OR Col_Name LIKE '%@%' OR Col_Description LIKE '%@%'
        ...

        SELECT * FROM MyOtherTable
        WHERE OtherCol_Name LIKE '%~%' OR OtherCol_Description LIKE '%~%'
        OR OtherCol_Name LIKE '%`%' OR OtherCol_Description LIKE '%`%'
        OR OtherCol_Name LIKE '%!%' OR OtherCol_Description LIKE '%!%'
        OR OtherCol_Name LIKE '%@%' OR OtherCol_Description LIKE '%@%'
        ...

        But maybe there's an easier way? Thank you in advance.

        Rafferty

        E Offline
        E Offline
        ed5756
        wrote on last edited by
        #3

        What you want to use is regular expressions. Plenty of examples on google, e.g. http://www.sqlteam.com/article/regular-expressions-in-t-sql[^]

        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