Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi all


Consider a table name PERSONS fields are p_id,p_name,p_area_code_p_phone.


p_id, p_name p_area_code p_phone. p_state
1 Shiana 00178 0002258965 punjab
2 Mandeep 00156 0000221996 punjab
3 Mehak 00159 0002218114 himachal
4 Rohit 00269 0000221206 Rajasthan
5 Raman 45285 2589994566 punjab

Now look at p_area_code and p_phone number
1. I need to concatenate the values of p_area_code and p_phone in one field which is p_phone

2.I need to remove all leading zero's(if any) where p_country is equal to punjab.
Posted
Comments
Abhinav S 14-Nov-10 1:11am    
Are these values stored as strings or numbers?

1 solution

Assuming both are stored as string -
select CONCAT( p_area_code,p_phone) as p_phone.

If they are both stored as numbers then you will need to additionally convert these numbers to strings use the CONVERT function.
 
Share this answer
 
Comments
shiana87 14-Nov-10 1:44am    
dis is fine for concatination thanks ..... but I need to remove all leading zero's(if any) where p_country is equal to punjab.

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