Drop Table statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Deletes a table in its entirety. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Drop Table table

table is the name of an open table.

Description

The Drop Table statement completely erases the specified table from the computer's disk. The table must already be open.

Note that if a table is based on a pre-existing database or spreadsheet file, the Drop Table statement will delete the original file as well as the component files which make it a table. In other words, a Drop Table operation may have the effect of deleting a file which is used outside of MapInfo Pro.

The Drop Table statement takes effect immediately; no save operation is required. You cannot undo the effect of a Drop Table statement by selecting Revert Table or Undo commands. Similarly, the MapBasic Rollback statement will not undo the effect of a Drop Table statement. You should be extremely cautious when using the Drop Table statement.

Note: Many MapInfo table operations (for example, Select) store results in temporary tables (for example, Query1). Temporary tables are deleted automatically when you exit MapInfo Pro; you do not need to use the Drop Table statement to delete temporary tables.

The Drop Table statement can also be used to delete a GeoPackage table. Deleting a GeoPackage table deletes the *.tab file and all associated component files. If a GeoPackage has only one table, using this statement will delete only the table and associate files, not the GeoPackage file.

The Drop Table statement cannot be used to delete a table that is actually a "view" For example, a StreetInfo table (such as SF_STRTS) is actually a view, combining two other tables (SF_STRT1 and SF_STRT2). So, you could not delete the SF_STRTS table by using the Drop Table statement.

Example

Open Table "clients"
Drop Table clients 

See Also:

Create Table statement, Delete statement, Kill statement