Interview Questions   Tutorials   Discussions   Programs   

DB2 - Can we drop column from a table?




345
views
asked mar August 25, 2014 11:12 AM  

Can we drop column from a table?


           

1 Answers



 
answered By Mswami   0  
To delete or drop a column, issue the following syntax:

   
ALTER TABLE TABLE_NAME
   DROP COLUMN COLUMN_NAME

Example 1: Drop table CORP.CONTRACTORS.

DROP TABLE CORP.CONTRACTORS;

Example 2: Drop table space TS1 in database CORP.

DROP TABLESPACE CORP.TS1;

Example 3: Drop the view CORP.PROJECTS:

DROP VIEW CORP.PROJECTS;

Example 4: Drop the package CONPACK with the version identifier V811. The package is in the collection CORPCOL.

DROP PACKAGE CORPCOL.CONPACK VERSION V811;

Example 5: Drop the package CORPPACK with the version identifier "2004-08-24-13.26.30.195269." Note that you must delimit the version identifier when a version identifier is generated by the VERSION(AUTO) option.

DROP PACKAGE CORPCOL.CORPPACK VERSION "2004-08-24-13.26.30.195269";

Example 6: Drop the distinct type TAXRETURN, if it is not currently in use:

DROP DISTINCT TYPE TAXRETURN;


flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert