Solved

Determine if 5th char in string is Alpha

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sqlquerystress - To test db performance 8 42
View SQL 2005 Job package 16 44
How to share SSIS Package? 6 37
How to make a stored procedure return two values 5 13
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

831 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