Reputation: 800
i have a table like this :
CREATE TABLE [Mytable](
[Name] [varchar](10),
[number] [nvarchar](100) )
i want to find [number]s that include Alphabet character?
data must format like this:
Name | number
---------------
Jack | 2131546
Ali | 2132132154
but some time number insert informed and there is alphabet char and other no numeric char in it, like this:
Name | number
---------------
Jack | 2[[[131546ddfd
Ali | 2132*&^1ASEF32154
i wanna find this informed row. i can't use 'Like' ,because 'Like' make my query very slow.
Upvotes: 0
Views: 635
Reputation: 32687
A bit outside the box, but you could do something like:
Of course, you could do the same thing with a cursor and a temp table or two...
Upvotes: 0
Reputation: 452978
Updated to find all non numeric characters
select * from Mytable where number like '%[^0-9]%'
Regarding the comments on performance maybe using clr and regex would speed things up slightly but the bulk of the cost for this query is going to be the number of logical reads.
Upvotes: 5