Monday, June 10, 2013

Add a column to a DB2 table in a specific position in V7R1

With the SQL command "ALTER TABLE" you are able to add columns to your DB2 Tables for a long time. But before V7R1 you can only add columns to the end of the row. In V7R1 you can use the "BEFORE column" clause to specify the exact position where your new column should be inserted. Here is an example:

Table "customer"

FieldType
Customer_NumberCHAR(10)
Customer_Name1CHAR(30)
Customer_addressCHAR(30)

With "ALTER TABLE customer ADD COLUMN Customer_Name2 CHAR(30) BEFORE Customer_address" can you add a second name column to the correct position.

No comments:

Post a Comment

ad