Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
DB2 insert query.

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

New User


Joined: 21 Sep 2007
Posts: 35
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

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
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: 35
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

Global Moderator


Joined: 06 Jun 2008
Posts: 8188
Location: East Dubuque, Illinois, USA

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: 35
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: 1439
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: 276
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

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Query on IEFBR14 with GDG Ashishpanpaliya JCL & VSAM 3 Tue Nov 07, 2017 8:34 pm
No new posts Query on XMITIP abdulrafi All Other Mainframe Topics 1 Wed Oct 25, 2017 6:54 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us