在access中创建表一般是用ado来执行sql语句来创建表。access中的字段类型在sql语句中是什么呢?在msdn中有篇文章介绍得很详细:
http://msdn.microsoft.com/office/understanding/access/codesamples/default.aspx?pull=/library/en-us/dnacc2k/html/acintsql.asp
下面是我写的一个sql语句,在delphi中用adoconnection对象执行成功:
create table 测试表 (
文本255 varchar not null,
文本20 varchar(20) not null,
日期时间 datetime,
数字1 byte,
数字2 smallint,
数字4 integer,
布尔 bit,
自动编号 counter(10, 5) constraint pk_tviplevel26 primary key,
小数 numeric,
单精度 real,
双精度 float default 0 not null,
备注 memo,
货币 currency,
ole对象 image)
在access的查询设计器中,该语句不能执行default 0;
其中:counter(10,5)表明初始值从10开始,每次递增5,如果没有(10,5),则是从1开始,每次递增1;
numeric表示小数,可以用numeric(18,2)指定有2位小数;
更多信息请查看上面的连接。