在Access中创建表及如何指定字段类型

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 thinkry 的 blog

在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位小数;

更多信息请查看上面的连接。

本文关键:在Access中创建表及如何指定字段类型
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top