MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Update query

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Piscesian
Beginner


Joined: 17 Dec 2004
Posts: 14
Topics: 8
Location: Monrovia,California

PostPosted: Fri Jun 01, 2007 6:31 pm    Post subject: Update query Reply with quote

Hi,

I need to update a particular DB2 table based on fixed set of values that I
have in an excel spreadsheet.
Code:

Table A                  Table B
                         
SANUM     = 1545         SANUM = 1545
BG_TYP_CD = 01           SC_CD = 139



Values in excel sheet
Code:

SC_CD      BG_TYP_CD
139        16
151        15
190        11
---        --       
---        --
 


I need to update BG_TYP_CD in Table A with value of 16
There are approx 1000 records that need to be updated.How do I achieve
this through an SQL query?
Back to top
View user's profile Send private message
William Thompson
Beginner


Joined: 15 May 2007
Posts: 5
Topics: 0

PostPosted: Fri Jun 01, 2007 6:50 pm    Post subject: Reply with quote

Got a lot a data manipulation in front of you....
Define the input format you need and then figure out how to produce that format from Excel....
Good luck.

ps, it can be done, I have (almost the same thing) done it, but I've slept since then....grin.....
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Jun 01, 2007 6:51 pm    Post subject: Reply with quote

Piscesian,

Try this

Code:

UPDATE Table_A
   SET BG_TYP_CD = 16
 WHERE SANUM     = (SELECT SANUM       
                      FROM Table_B           
                     WHERE SC_CD = 139);


If you want to do it 1000 rows then upload the excel to the mainframe and run it thru a utility to generate the sql statement shown above

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Piscesian
Beginner


Joined: 17 Dec 2004
Posts: 14
Topics: 8
Location: Monrovia,California

PostPosted: Sat Jun 02, 2007 5:15 pm    Post subject: Reply with quote

Thanks William,Kolusu for your inputs....
Back to top
View user's profile Send private message
sendhil
Beginner


Joined: 06 Sep 2006
Posts: 17
Topics: 6

PostPosted: Sat Jun 02, 2007 8:45 pm    Post subject: Reply with quote

A formula in excel might do the trick? You can generate the sql in excel itself.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group