Purpose
Adds a new, temporary column to an open table, or updates an existing column with data from another table. You can issue this statement from the MapBasic window in MapInfo Pro.
Syntax
Add Column table ( column [ datatype ] )
{ Values const [ , const ... ] |
From source_table
Set To expression
[ Where { dest_column = source_column |
Within | Contains | Intersects } ]
[ Dynamic ] }
table is the name of the table to which a column will be added.
column is the name of a new column to add to that table.
datatype is the data type of the column, defined as Char(width), Float, Integer, SmallInt, Decimal(width, decimal_places), Date or Logical, DateTime; if not specified, type defaults to Float.
source_table is the name of a second open table.
expression is the expression used to calculate values to store in the new column; this expression usually extracts data from the source_table, and it can include aggregate functions.
dest_column is the name of a column from the destination table (table).
source_column is the name of a column from the source_table.
Dynamic specifies a dynamic (hot) computed column that can be automatically update: if you include this keyword, then subsequent changes made to the source table are automatically applied to the destination table.
Description
The Add Column statement creates a temporary new column for an existing MapInfo Pro table. The new column will not be permanently saved to disk. However, if the temporary column is based on base tables, and if you save a workspace while the temporary column is in use, the workspace will include information about the temporary column, so that the temporary column will be rebuilt if the workspace is reloaded. To add a permanent column to a table, use the Alter Table statement and Update statement.
See Also: