Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
DB2 insert query.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
saubhik

New User


Joined: 21 Sep 2007
Posts: 17
Location: kolkata

PostPosted: Wed Jul 23, 2008 10:23 pm    Post subject: DB2 insert query.
Reply with quote

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
View user's profile Send private message
References
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1001
Location: Virginia, USA

PostPosted: Wed Jul 23, 2008 10:34 pm    Post subject:
Reply with quote

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
View user's profile Send private message
saubhik

New User


Joined: 21 Sep 2007
Posts: 17
Location: kolkata

PostPosted: Wed Jul 23, 2008 10:43 pm    Post subject: Reply to: DB2 insert query.
Reply with quote

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
View user's profile Send private message
Robert Sample

Senior Member


Joined: 06 Jun 2008
Posts: 936
Location: Atlanta, GA

PostPosted: Wed Jul 23, 2008 10:53 pm    Post subject:
Reply with quote

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
View user's profile Send private message
saubhik

New User


Joined: 21 Sep 2007
Posts: 17
Location: kolkata

PostPosted: Wed Jul 23, 2008 11:17 pm    Post subject: Reply to: DB2 insert query.
Reply with quote

Thanks man!!i think it will work.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1477
Location: Bangalore,India

PostPosted: Thu Jul 24, 2008 8:32 am    Post subject:
Reply with quote

Saubhik,

Quote:
i think it will work.

What happend? Did it work.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 298
Location: Bang,iflex

PostPosted: Thu Jul 24, 2008 11:54 am    Post subject:
Reply with quote

Murali,


It should work!!!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Senior Member


Joined: 20 Oct 2006
Posts: 1633
Location: germany

PostPosted: Thu Jul 24, 2008 12:11 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1