Dropping Database Objects
Database objects can be dropped from various contexts:
•From the Online Browser
•From the Design Editor
•By generating a DROP statement in the SQL Editor
Note that SQLite and DB2 for i databases do not support altering the structure of an existing table by dropping columns. For such databases, the commands for dropping a column are disabled in DatabaseSpy. |
From the Online Browser
To drop a database object:
1.Do one of the following:
•In the Online Browser, right-click a database object and select Delete from the context menu.
•In the Online Browser, select one or more database objects and press Delete.
DatabaseSpy generates the required script and displays it in the Database Structure Change Script window, for example:
Note: | At this stage, the changes are not committed to the database yet. In the Online Browser, the icon appears to the left of the object name, which indicates that you are about to delete it. To undo the drop operation without committing it to the database, click Refresh data source in the Online Browser. |
2.Optionally, to modify the generated script before running it, click the Edit Change Script button.
3.In the Database Structure Change Script window, click Execute Change Script .
From the Design Editor
To drop a database object:
1.Do one of the following:
•In the Design Editor, right-click a database object and choose Delete selected Objects from the context menu.
•In the Design Editor, select one or more database objects and press Delete.
DatabaseSpy generates the required script and displays it in the Database Structure Change Script window. Also, the icon appears to the left of the object name, which indicates that you are about to delete it (in the image below, a table is about to be deleted).
Note: | At this stage, the changes are not committed to the database yet. To undo the delete operation without committing it to the database, click Refresh data source in the Online Browser. |
2.Optionally, to modify the generated script before running it, click the Edit Change Script button.
3.In the Database Structure Change Script window, click Execute Change Script .
By generating SQL
To drop a database object by generating a DROP statement:
1.In the Online Browser, right-click a database object and select Show in new SQL Editor | Drop from the context menu.
2.Click the Execute button at the top of SQL Editor (or press F5). The outcome is reported in the Message window.