Erwin Pombett
asked on
how can i update a phone recored in sqlserver (tsql) ?
hello,
i have a table with correct and wrong phone numbers.
wrong phone number : i need to delete the third '0' and keep the rest of the number as it is
+630798214614
here there's no 0 before the 7, there's nothing to do.
+63798214774
what would be the query in order to repair this ?
thank you in advance.
i have a table with correct and wrong phone numbers.
wrong phone number : i need to delete the third '0' and keep the rest of the number as it is
+630798214614
here there's no 0 before the 7, there's nothing to do.
+63798214774
what would be the query in order to repair this ?
thank you in advance.
ASKER
Hello , yes, i think so ,
i'm goign to pass a query in order to check the lenght...
ok. there's spaces for somme of them, so i will remove teh spaces.
can the following replace space with empty char ?
then for everbody i can remove the where ?
update person
set MobilePhone = replace(MobilePhone, ' ', '')
where personID = '90882'
i'm goign to pass a query in order to check the lenght...
ok. there's spaces for somme of them, so i will remove teh spaces.
can the following replace space with empty char ?
then for everbody i can remove the where ?
update person
set MobilePhone = replace(MobilePhone, ' ', '')
where personID = '90882'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yep, you can replace(phone,' ','') for all....
EDIT: gotta duck out for an hour....
EDIT: gotta duck out for an hour....
because you could do
select left(phone,3) + right(phone,9)
where substring(phone,4,1) = '0'
and len(phone) = 13
Will have a better go at it in a couple of minutes...