有空还是多看看帮助,对自己有好处!A. Alter a table to add a new columnThis example adds a column that allows null values and has no values provided through a DEFAULT definition. Each row will have a NULL in the new column.CREATE TABLE doc_exa ( column_a INT)
GO
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL
GO
DROP TABLE doc_exa
GO
GO
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL
GO
DROP TABLE doc_exa
GO
贴一段:
procedure TForm1.FormCreate(Sender: TObject);
begin
with ClientDataSet1 do
begin
with FieldDefs.AddFieldDef do
begin
DataType := ftInteger;
Name := 'Field1';
end;
with FieldDefs.AddFieldDef do
begin
DataType := ftString;
Size := 10;
Name := 'Field2';
end;
with IndexDefs.AddIndexDef do begin
Fields := 'Field1';
Name := 'IntIndex';
end;
CreateDataSet;
end;
end;