IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

updating a db2 table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
janmejay
Warnings : 1

New User


Joined: 22 Jun 2007
Posts: 85
Location: bangalore

PostPosted: Wed Nov 04, 2009 10:00 am
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

Moderator Emeritus


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

PostPosted: Wed Nov 04, 2009 10:20 am
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
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
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: 1281
Location: Belgium

PostPosted: Wed Nov 04, 2009 1:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top