Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

updating a db2 table

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

New User


Joined: 22 Jun 2007
Posts: 81
Location: bangalore

PostPosted: Wed Nov 04, 2009 10:00 am    Post subject: updating a db2 table
Reply with quote

Hello

i have a db2 table which contains a phone_no field.
lets example
phone_no
___________

5223432
5234567
5244568
5367902

now i need to update the phone_no field.the starting no. 5 should be replaced by 6.
how to update at a single time , so that all phone nos starting with 5 should be replaced by 6.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Nov 04, 2009 10:20 am    Post subject:
Reply with quote

Hello,

Is there some reason this is posted in the idms part of the forum?

You need to provide more info. . .

How is phone_no defined? If it the primary key? Is it a unique key?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Nov 04, 2009 10:28 am    Post subject:
Reply with quote

Code:

UPDATE yourtablename
SET phone_no = phone_no + 1000000       
WHERE phone_no BETWEEN 5000000 AND 5999999;


If it is not unique or primary key.. above will work for you.
Back to top
View user's profile Send private message
santosh100678

New User


Joined: 21 Sep 2009
Posts: 55
Location: Kolkatta

PostPosted: Wed Nov 04, 2009 12:21 pm    Post subject: upload db2 table using input as file throu jcl
Reply with quote

Hi

I need sample jcl throu which i upload db2 table using input as a file

1.Input file I have 2 generate thru cobol pgogram
2. first create input file thru cobol
3. submit jcl usiing above input file.
4. if some column in db2 table is varchar then during upload process from file to db2 table any change required .
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Wed Nov 04, 2009 1:27 pm    Post subject:
Reply with quote

Sambhaji wrote:
Code:

UPDATE yourtablename
SET phone_no = phone_no + 1000000       
WHERE phone_no BETWEEN 5000000 AND 5999999;


If it is not unique or primary key.. above will work for you.

Why shouldn't it be primary key ?
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us