SQL/MX 2.x Installation and Management Guide (G06.24+, H06.03+)

Adding, Altering, and Dropping SQL/MX Database
Objects
HP NonStop SQL/MX Installation and Management Guide523723-004
9-30
Dropping Constraints
4. Use the DISPLAY USE OF command to identify which user modules are
associated with this object. See the similarity check criteria in the SQL/MX
Programming Manual for C and COBOL and the SQL/MX Programming Manual for
Java to determine if your changes are likely to cause similarly check to fail and
force automatic recompilation. If they will, you should SQL compile these modules
after making the changes to avoid expensive automatic recompilations at run time.
SQL applications that are running while you make these changes will still undergo
automatic recompilation.
For information about explicit and automatic recompilation, see the SQL/MX
Programming Manual for C and COBOL and the SQL/MX Programming Manual for
Java. For information about using DISPLAY USE OF, see Checking Module
Dependencies With DISPLAY USE OF on page 11-20 and the SQL/MX Reference
Manual.
5. Enter the CREATE TABLE statement to create a new table definition that does not
contain the column you want to drop.
6. After creating the new table, load the old table’s data into the new table with
INSERT/SELECT statements.
7. After the loading the new table, drop the old table.
8. Revise the application source code as needed to reflect your changes to the
database. Process and compile the updated source file. For more information, see
the SQL/MX Programming Manual for C and COBOL and the SQL/MX
Programming Manual for Java.
Dropping Constraints
To drop a constraint, use the ALTER TABLE DROP CONSTRAINT statement.
Dropping constraints on the database is similar to making a program change. Any
future data inserts or updates will not have to satisfy the constraint. The ALTER TABLE
DROP CONSTRAINT statement drops only the constraint definition from the table and
does not affect the data in the table.
Dropping a constraint on a table invalidates the programs that depend on the table.
You should include steps to explicitly SQL compile the dependent programs to avoid
automatic recompilation and to return the application to a valid state.
For more information, see the SQL/MX Reference Manual.