Solved

sql server query

Posted on 2016-09-07
4
61 Views
Last Modified: 2016-09-07
I am not sure how to create an sql server query that will return the strings that have no numeric characters in them and then another that has ability to return mixed i.e A'4'.

The field word only holds one word.

so:
'0'
'001001101'
'F1'
'1f'
 would not be returned

words :

'sweeper'
'bhp'

would be returned the field name is word from Tblwords
0
Comment
Question by:PeterBaileyUk
  • 3
4 Comments
 

Author Comment

by:PeterBaileyUk
ID: 41787404
ive just tried:
use Dictionary
select word
from TblWords
where word is not null and word not like'%[0-9]'
group by word
order by word

Open in new window


thats giving me where there is mixture of alpha numeric.

thats one part done

the alpha characters only i cannot word out can i do A-z ?
0
 
LVL 47

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 41787405
You can use PATINDEX:
SELECT *
FROM tblWords
WHERE PATINDEX('%[0-9]%',Word)=0

Open in new window

0
 

Author Comment

by:PeterBaileyUk
ID: 41787407
and failed with this:
use Dictionary
select word
from TblWords
where word is not null and word like'[A-Z][a-z]'
group by word
order by word

Open in new window

0
 

Author Closing Comment

by:PeterBaileyUk
ID: 41787408
thank you Vitor
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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

803 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