Prefix 0 in a Phone number string SQL

0

Please login or register to vote for this query.

(click on this box to dismiss)

Robotics

Q&A for professional robotic engineers, hobbyists, researchers and students

declare @phone_nums as table(
  [phone_number] varchar(20)
);

insert into @phone_nums values  
('7863176061'),
('7724269820'),
('2088076157'),
('1992762084'),
('1318912');

update  @phone_nums set  [phone_number] = '0' + [phone_number]
   where  len([phone_number]) = 9

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results