Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Dropping a column in DB2 7.2

This is a simple way to drop a column in DB2 7.2 for those who do not use a third-party software solution.

This is a simple way to drop a column to update their DB2 7.2 databases for those who do not use third-party software like Quest or DBArtisan. Before executing the code, you need to drop the dependencies on the table and after the code is executed, just recreate them, like this:

ALTER TABLE <old_name> RENAME TO <another_name>
Then recreate the old table without the deleted column(s):
SELECT col1, col2, col4 INTO TABLE <old_name> FROM <another_name>
Then delete the old table:
DROP TABLE <another_name>

For More Information

  • Feedback: E-mail the editor with your thoughts about this tip.
  • More tips: Hundreds of free DB2 tips and scripts.
  • Tip contest: Have a DB2 tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
  • Ask the Experts: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.
  • Forums: Ask your technical DB2 questions--or help out your peers by answering them--in our active forums.
  • Best Web Links: DB2 tips, tutorials, and scripts from around the Web.

Dig Deeper on DB2 UDB (universal databases)

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close