--Microsoft SQL Valid Telephones with Regex Regular Expressions
-- find telephone number with valid format
select *, 'phone valid' [is valid?]
from [dbo].[options on fx majors]
where telephone like '%[+][0-9]%[(][0-9][)][0-9]%'
-- find telephone number without valid format
union all
select *, 'phone not valid' [is valid?]
from [dbo].[options on fx majors]
where telephone not like '%[+][0-9]%[(][0-9][)][0-9]%';
-- find telephone number with valid format
select *, 'phone valid' [is valid?]
from [dbo].[options on fx majors]
where telephone like '%[+][0-9]%[(][0-9][)][0-9]%'
-- find telephone number without valid format
union all
select *, 'phone not valid' [is valid?]
from [dbo].[options on fx majors]
where telephone not like '%[+][0-9]%[(][0-9][)][0-9]%';
No comments:
Post a Comment