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
 

 

help related to sql query

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

New User


Joined: 31 Jul 2003
Posts: 4

PostPosted: Tue Aug 19, 2003 2:43 pm    Post subject: help related to sql query
Reply with quote

Hi All,
would anyone please give me the query for the below requirements
1.Need to change all the nullable values for column department with value 'abc' for a table.Here the column department is nullable.
2.I have a table with three columns a1,a2,a3.Here a1 is the primary key.The requirement is such that I have to add one more column a4 to this table and make this column a4 as the primary key instead of a1.How should I proceed with this requirement.Please give me the steps.
All sorts of help appreciated.
Thanks
mfguy
Back to top
View user's profile Send private message

mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 238
Location: USA

PostPosted: Tue Aug 19, 2003 3:54 pm    Post subject:
Reply with quote

Hello mfguy,

1)

UPDATE DEPTTBL SET DEPARTMENT = 'ABC' WHERE DEPARTMENT IS NULL


2)

follow the procedure below:
Code:

      a) drop the primary key constraint
      b) add a column
      c) based on conditions, make each row value unique and then add the
          primary key constraint.


This is possible only when the data added to the column is distinct.

Plz correct me if i am wrong anywhere,

Hope this will help you.

Regards

Mayuresh Tendulkar
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1202
Location: India

PostPosted: Wed Aug 20, 2003 8:02 am    Post subject: Re
Reply with quote

Dear tendulkar,

You are not wrong... Good work. Keep it up. But you may need to create an UNIQUE Index on column A4 before adding the Primary key. (if you are not using a Schema Processor).
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 Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm


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