Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jimoomba
Yak Posting Veteran
90 Posts |
Posted - 2011-11-21 : 09:21:34
|
| Hi AllIam having Users table which contains the users information data retrieved from Active directory. The users table contains mobilenumber column also. Now i want to validate for the mobilenumber retrieved if it has the countrycode as '91'. If it does not start with prefix as '91' then i need to append the saved mobile number with the prefix '91'. For example if the mobile no is '900080000' then it should append as '91900080000'Kindly let me know the query for this.Thanks,Ramrams |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2011-11-21 : 10:14:45
|
| check for the country code. If the code appears, then append 91 to your mobile number. Does not sound hard at all. what have you tried so far?http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-21 : 11:11:58
|
| [code]UPDATE TableSET PhoneNumber = 9100000000+PhoneNumberWHERE PhoneNumber /100000000 <> 91[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-11-22 : 01:38:05
|
| What is the datatype of mobileno column?UPDATE TableSET PhoneNumber = '91'+PhoneNumberWHERE LEN(PhoneNumber)<=10orUPDATE TableSET PhoneNumber = '91'+PhoneNumberWHERE PhoneNumber like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|