Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query for non Alpha data

Author  Topic 

wsilage
Yak Posting Veteran

82 Posts

Posted - 2013-06-28 : 11:32:27
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

52326 Posts

Posted - 2013-06-28 : 11:34:32
[code]
SELECT middlename FROM pro WHERE Field LIKE '%[^A-Za-z]%'
[/code]

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

sshelper
Posting Yak Master

216 Posts

Posted - 2013-07-01 : 01:14:19
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
   

- Advertisement -