Solved

String check - AlphaNumeric

Posted on 2008-10-03
2
3,026 Views
Last Modified: 2012-05-05
I need a way to check a string to see if it contains a mixture of alpha and numerics - also need to check if one is just alpha or just numeric - whichI think I can do from the below - but not certain how to check to see if contains any mixture of alpha and numerics.

-- Numeric only check?
WHEN PATINDEX('%[^0-9]%', @var) = 0

Alpha only check?
WHEN PATINDEX('%[^A-Z]%', @var) = 0
0
Comment
Question by:tbaseflug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22634518
alphanum only:
WHEN PATINDEX('%[^0-9A-Z]%', @var) = 0

Open in new window

0
 

Author Closing Comment

by:tbaseflug
ID: 31502777
Perfect - thanks!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question