?
Solved

Determine if 5th char in string is Alpha

Posted on 2008-10-29
3
Medium Priority
?
1,061 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
[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
3 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 2000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

800 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