If you want to add a field to a datasheet, how do you say it? The following is a description of the SQL statement for adding fields to your table , and hopefully gives you a deeper understanding of SQL statements.
General: ALTER TABLE [ table name ] Add [ field name ] field attribute default default is optional parameter /c15> add field: ALTER TABLE [ table name ] Add field name smallint default 0 Add Number field, Integer, default value 0 ALTER TABLE [ table name ] Add field name int default 0 Add Number field, Long integer, default value is 0 ALTER TABLE [ table name ] Add field name single default 0 Add Number field, one type, default value is 0 ALTER TABLE [ table name ] Add field name double default 0 Add Numeric field, double type, default value is 0 /c11> ALTER TABLE [ table name ] Add field name Tinyint default 0 Add Numeric field, byte type, default value is 0 ALTER TABLE [ table name ] Add field name text [null] Add Memo Type field,[null] optional parameter ALTER TABLE [ table name ] Add field name memo [NULL] Add Memo field,[null] optional parameter ALTER TABLE [ table name ] Add field name varchar(n) [null] increase variable length text Type field size N (1~255) ALTER TABLE [ table name ] Add field name char [null] increase fixed length text Type field size to 255 ALTER TABLE [ table name ] Add field name datetime default function increment date Type field where function can be now (),date(), and so on, indicating the default value (The above is the most common, there are other properties, you can refer to the following data type description)Delete field: ALTER TABLE [ table name ] drop field name Modify the size of a variable-length text field:ALTER TABLE [ table name ] Alter field name varchar(N) Delete tables: drop table [ table name ] To Create a table:SQL="CREATE table [ table name ] ([ field 1, and set as primary key ] int IDENTITY (1, 1) not NULL CONSTRAINT PrimaryKey PRIMARY KEY,"& [ field 2] varchar(+),"& "[ field 3] Single default 0," & [ field 4] varchar(+) null,"& "[ field 5] smallint default 0," & "[ field 6] int default 0," & [ field 7] Date default Date(),"& "[ field 8] int default 1)" Conn. Execute SQL a null representation field allows 0 long
How to write a SQL statement that adds a field to a data table