Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

extracting valid mobile numbers

$
0
0

hi All,

im trying to

extract the valid mobile numbers with out any other charecters(*,/,+ etc..) only numeric 10 digited number.

EX:*091234567890--output should be 91234567890 

Ex2:091234567890**--91234567890 

so dynamically i will get 10 digits in sequence i get but i should consider only 10 digits to output

declare @mobile table(MOBILE varchar(16),Result VARCHAR(10))
insert into @mobile
select '(+91)-9234567890','VALID' union
select '92345678990*','VALID' union all
select '91-9234567890','VALID' union all
select '(91)9234567890','VALID' union all
select '+9234567890*','VALID' union all
select '(9234567890','VALID' union all
select '09234567890' ,'VALID' union all
select '9234567890-','VALID' union all
select '+923456789*' ,'INVALID' union all
select '+234567890*' ,'INVALID' union all
select '97(31)-789889','INVALID' union all
select '+234567890&' ,'INVALID'
--
select * from @mobile





Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>