在Access中建立表及如何指定字段型別

2021-06-15 18:13:35 字數 694 閱讀 7279

在access中建立表一般是用ado來執行sql語句來建立表。access中的字段型別在sql語句中是什麼呢?在msdn中有篇文章介紹得很詳細:

下面是我寫的乙個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位小數;

更多資訊請檢視上面的連線。

用c 在Access資料庫中建立新錶

生成表newtable,該錶有文字欄位field1和整型欄位field2 private void createnewtable 下面是轉貼的 用sql建立資料庫 首先說說怎麼用sql語句建立資料庫,建立資料庫的語句有如下幾種 1.create table 建立新錶 2.create index 增...

如何在ACCESS資料庫表中建立各種資料型別的字段

dim conn as new adodb.connection dim rs as new adodb.recordset private sub command1 click 長整型 on error goto dataerr dim connstr as string dim sql as s...

在ACCESS中, 及 符號之差別為何?

適用 access97 2000 這是大哉問,惱人的是程式往往因乙個符號之差別,而致無法動作,偏偏非死記不可,因為軟體也是人發明的。這兩個符號可分兩方面說明 一 非 在查詢或窗體文字框之 資料來源 屬性內,通常會以此表示法取用另一窗體之某控制項內容,如 forms 客戶 姓名 兩個 符號分別表示其後...