Use Absolute Database DBManager utility (...\AbsoluteDatabase\Ultils\Bin\DBManager.exe), if you would like to change table structure manually.
To alter table from your application using TABSTable component, you could perform the following steps:
Example:
var
Log: String;
{set up table component}
ABSTable1.DatabaseName := 'emp_db';
ABSTable1.TableName := 'employee';
{fill in restructure properties}
ABSTable1.Open;
ABSTable1.Close;
with ABSTable1 do
begin
{specifying new table fields}
with RestructureFieldDefs do
begin
Add('Hobby',aftString,30,False);
Add('Comment',aftMemo,0,False);
end;
{specifying new table indexes}
with RestructureIndexDefs do
begin
Add('idxHobby','Hobby',[]);
end;
{restructure}
if (RestructureTable(Log)) then
ShowMessage('Restructure completed')
else
ShowMessage('Restructure errors: '+Log);
end;
Note: See also how to alter table using SQL ALTER TABLE Command.
|
|