SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query for non Alpha data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

wsilage
Yak Posting Veteran

USA
76 Posts

Posted - 06/28/2013 :  11:32:27  Show Profile  Reply with Quote
We have a field that has been adding "/" in it. I need to create a query that pulls anything thing that is not an alpha letter. How can I do that? I have never created anything like this before.

Select Distinct middleName from pro

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 06/28/2013 :  11:34:32  Show Profile  Reply with Quote

SELECT middlename FROM pro WHERE Field LIKE '%[^A-Za-z]%'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

sshelper
Posting Yak Master

216 Posts

Posted - 07/01/2013 :  01:14:19  Show Profile  Visit sshelper's Homepage  Reply with Quote
Just in case there are spaces in the middle name or even periods (which may be valid since the user might have just entered a middle initial with a period), you can add those characters to the query provided by visakh16:

SELECT middlename FROM pro WHERE middlename LIKE '%[^A-Za-z .]%'

But if you just want to search for "/", you can do it this way:

SELECT middlename FROM pro WHERE middlename like '%/%'

SQL Server Helper
http://www.sql-server-helper.com/tips/tip-of-the-day.aspx?tkey=1763bcb4-0345-493f-bbaa-469694472aa4&tid=91&tkw=sql-server-database-design---facebook-profile-and-friends
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000