Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a table with below struct :

1-customer_id int
2-tel_number nvarchar(20)
3-tel_type tinyint

in tel_number field exists numbers like 44431223
now i want add string "76" to cells that has 8 character length (like 44331223)

example :
before execute query tel_number field contents is :
09167119004

44431223
44512112
44211451

09129874663


after execute query tel_number field contents is :
09167119004

7644431223
7644512112
7644211451

09129874663


How Do i Write SQL Query that do this operation ?

thanks
Posted

1 solution

Like this:

SQL
UPDATE Customers
SET tel_number = ('76' + tel_number)
WHERE LEN(tel_number) = 8
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900