View previous topic :: View next topic
|
Author |
Message |
saubhik
New User
Joined: 21 Sep 2007 Posts: 35 Location: kolkata
|
|
|
|
Suppose i have a table which has a 4 digit column called Telephone number(for eg 1234,1111,etc).If i want to add 9 infront of the number.How can we do it thru a SQl query.Like after the execution of the query the telephone number will be like(91234,91111). |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
If its a 4 digit column then it can't contain an 8 digit value so you wouldn't be able to insert a '9' anyways. What is the definition of this column? |
|
Back to top |
|
|
saubhik
New User
Joined: 21 Sep 2007 Posts: 35 Location: kolkata
|
|
|
|
suppose you have changed the column definition so that it can accomodate 5 digit number.Then also how can we insert 9 before that 4 digit number. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I'm no DB2 expert, but can't you do something like
Code: |
UPDATE TABLE SET TELEPHONENUMBER = TELEPHONENUMBER + 90000 WHERE TELEPHONENUMBER > 1000 |
|
|
Back to top |
|
|
saubhik
New User
Joined: 21 Sep 2007 Posts: 35 Location: kolkata
|
|
|
|
Thanks man!!i think it will work. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Saubhik,
Quote: |
i think it will work. |
What happend? Did it work. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Murali,
It should work!!! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if telephone no is char (or varchar), it will not work.
but then we do not know the datatype of the column in question. |
|
Back to top |
|
|
|