Solved

Determine if 5th char in string is Alpha

Posted on 2008-10-29
3
1,056 Views
Last Modified: 2012-06-27
I need to add to my where clause a condition if a certain string's 5th char, within the string is alpha - so

12345 - OK
1234F - Not OK
0
Comment
Question by:tbaseflug
3 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22831288
select * from table
where case when isnumeric(substring(fieldname, 5,1)) = 1 then 1 else 0 end = 1
0
 

Author Closing Comment

by:tbaseflug
ID: 31511175
Perfect = thanks!
0
 
LVL 39

Expert Comment

by:appari
ID: 22831525
isnumeric returns 1 for - also

select  isnumeric('-')

try some thing like this

Select * from
(Select '1234A' F1) as A
where F1 like '____[0-9]%'

select * from tableName where FieldName like '____[0-9]%'

where
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now