Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select SQL Non numeric Values

Tags:

sql-server

I need to select just the rows within a sql table which contain no numerical values whatsoever, here's an example table:

AddressLine1
-------------
59 Prospect Road
Rose House
24 St. Pauls Place
1 Oxford Avenue
9 Stonecross Road
65 Wood Common
19 Falcon Close
Thorn House
16 Poplars Close
52 Coombes Road
12 Brinsmead
14 Meadow Close
15 Rowlatt Drive

In this example I would just be looking for "Rose House" and "Thorn House" rows to be returned.

Any suggestion on the code I should be using would be gratefully received.

like image 731
Adam Haycock Avatar asked Jan 07 '16 10:01

Adam Haycock


2 Answers

select * from tab
where AddressLine1 not like '%[0-9]%'

try this

like image 186
Akshey Bhat Avatar answered Oct 19 '22 23:10

Akshey Bhat


I think the actual answer should be:

select * from tab where AddressLine1 like '%[^0-9]%'

According to: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/like-transact-sql?view=sql-server-ver15

like image 34
INS Avatar answered Oct 19 '22 22:10

INS