ITable.UpdateTable

Syntax

UpdateTable([Options: Integer = 0]);

Parameters

Options is reserved parameter.

Description

The UpdateTable method updates the structure of table on database server according to structure of current table.

This method is analog of the AlterTable method. At operation of the UpdateTable method, the structure of current table in repository is taken as table structure that should be updated.

The information on following table elements is updated:

If the OldTable table contains elements that are not present in the current table, they are removed, if the current table contains elements that are not present in the OldTable table, they are added.

Example

Sub Main;

Var

Mb:IMetabase;

MbObj:IMetabaseObject;

Table:ITable;

Fields:ITableField;

Begin

Mb:=MetaBaseClass.Active;

MbObj:=Mb.ItemById("Table_1").Edit;

Table:=MbObj As ITable;

Fields:=Table.Fields.Add;

Fields.Id:="PoleX";

Fields.Name:="PoleX";

Fields.DataType:=DbDataType.Integer;

Fields.Size:=10;

Table.UpdateTable;

End Sub Main;

After executing the example, the table field in database is added without changing table structure in repository. The repository table identifier is Table_1.

See also:

ITable