If I have a view that uses a column, and I remove that column/table, the view is dropped automatically.
Is there a setting I can change such that it instead prevents the removal of the column/table, warning that it has dependencies?
Operation System: I5 or IBM i
Operating System Version: V7R1M0
[From comment] The view is not dropped; it may be marked as invalid.
SELECT * FROM QSYS2.SYSTABLES
WHERE SYSTEM_TABLE_SCHEMA = 'MYLIB' and table_name = 'MYVIEW';
--returns 1 row
ALTER TABLE MYLIB.MYTABLE DROP COLUMN TEST2;
SELECT * FROM QSYS2.SYSTABLES
WHERE SYSTEM_TABLE_SCHEMA = 'MYLIB' and table_name = 'MYVIEW';
--returns 0 rows
…That looks to me like it was dropped?
Best Answer
For i-series, at least for 7.1, you can try the RESTRICT clause of DROP COLUMN.
There is also a RESTRICT clause for DROP TABLE.
Per documentation