This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||
|
4D v20
DROP TABLE
|
DROP TABLE [IF EXISTS] sql_name |
||
The DROP TABLE command is used to remove the table named sql_name from a database. When the IF EXISTS constraint is passed, if the table to be removed does not exist in the database, the command does nothing and no error is generated.
This command not only removes the table structure, but also its data and any indexes, triggers and constraints that are associated with it. It cannot be used on a table that is referenced by a FOREIGN KEY constraint.
Note: You must make sure that when the DROP TABLE command is executed, there are not any records of the sql_name table that are loaded in memory in write mode. Otherwise, the error 1272 is generated.
Since this command modifies the database structure, it cannot be used in the context of a read-only packaged application (.4dc file installed in the Program Files folder or .4dz file).
Here is a simple example which removes the ACTOR_FANS table:
DROP TABLE ACTOR_FANS
This example does the same as the one above except that in this case, if the ACTOR_FANS table does not exist, no error is generated:
DROP TABLE IF EXISTS ACTOR_FANS
Product: 4D
Theme: SQL Commands
4D SQL Reference ( 4D v20)