This is my code:
FUNCTION [dbo].[Vmobile](@mobileno VARCHAR(50))
--Returns true if the string is a valid mobile no.
RETURNS bit
AS
BEGIN
DECLARE @valid bit
IF @mobileno IS NOT NULL
SET @valid = 0
IF @mobileno like '^(?:0|\+?44)(?:\d\s?){9,10}$'
SET @valid=1
RETURN @valid
END
The phone numbers can be in any UK format but it should support all UK Phone numbers. E
g :
(415) 555-0132
+44 313314332
098 765 1234
+447975777666
07975777666
xxx-xxx-xxxx
01332 412251
01332 412 251
+44 1332 412251
where X can be any number. Optional Plus can be allowed at first position only. It should have 9 or 10 digit after zero if zero is entered in the beginning. country code can be optional