Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 496749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:42:56+00:00 2026-05-13T05:42:56+00:00

I was actually asked this myself a few weeks ago, whereas I know exactly

  • 0

I was actually asked this myself a few weeks ago, whereas I know exactly how to do this with a SP or UDF but I was wondering if there was a quick and easy way of doing this without these methods. I’m assuming that there is and I just can’t find it.

A point I need to make is that although we know what characters are allowed (a-z, A-Z, 0-9) we don’t want to specify what is not allowed (#@!$ etc…). Also, we want to pull the rows which have the illegal characters so that it can be listed to the user to fix (as we have no control over the input process we can’t do anything at that point).

I have looked through SO and Google previously, but was unable to find anything that did what I wanted. I have seen many examples which can tell you if it contains alphanumeric characters, or doesn’t, but something that is able to pull out an apostrophe in a sentence I have not found in query form.

Please note also that values can be null or '' (empty) in this varchar column.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:42:56+00:00Added an answer on May 13, 2026 at 5:42 am

    Won’t this do it?

    SELECT * FROM TABLE
    WHERE COLUMN_NAME LIKE '%[^a-zA-Z0-9]%'
    

    Setup

    use tempdb
    create table mytable ( mycol varchar(40) NULL)
    
    insert into mytable VALUES ('abcd')
    insert into mytable VALUES ('ABCD')
    insert into mytable VALUES ('1234')
    insert into mytable VALUES ('efg%^&hji')
    insert into mytable VALUES (NULL)
    insert into mytable VALUES ('')
    insert into mytable VALUES ('apostrophe '' in a sentence') 
    
    SELECT * FROM mytable
    WHERE mycol LIKE '%[^a-zA-Z0-9]%'
    
    drop table mytable 
    

    Results

    mycol
    ----------------------------------------
    efg%^&hji
    apostrophe ' in a sentence
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is actually related to a question I asked earlier, but I was left
Actually, my question was asked a year ago in this topic - Why do
I've actually asked about this already in this post although we've gone back to
apologies if this has been asked before but I have searched the site... Anyway,
Actually, this question seems to have two parts: How to implement pattern matching? How
Actually, I'm using this way. Do you have a better way? private bool AcceptJson(HttpRequest
I actually have an answer to my question but it is not parallelized so
I actually have two questions regarding the same problem but I think it is
Krumelur asked this question about how create a recipient bubble similar to the mail.app.
We need to create a program ..actually we were asked to create a software

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.