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
Solved

Determine if 5th char in string is Alpha

Posted on 2008-10-29
3
1,058 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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.

809 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