昨天BOSS下了個命令讓我用word宏的方式來快速生成sql,這樣在我們建表的時候就不用在一條一條元數(shù)據(jù)的輸入。從而提高效率節(jié)約成本:
接到命令后就開始著手來做,一邊上網(wǎng)搜相關(guān)的現(xiàn)成的材料,一邊看vb宏的視頻教程。終于讓我寫出了這個程序,雖說有點兒小吧,可是感覺挺好的。
這里的vb宏要針對固定的數(shù)據(jù)庫數(shù)據(jù)字典表格進行的。
由于代碼太長就不拿出來了,這里是word中的表格式和vb運行后的結(jié)果如下:
文件名稱
T_Test
中文描述
用戶信息表
序
號
字段名
中文說明
數(shù)據(jù)類型
長度
缺省
允許
空值
主鍵
1
userid
主鍵ID
Integer
10
√
2
username
用戶名
Varchar
50
Chen
3
password
密碼
Varchar
30
我的
4
telephone
用戶電話
Varchar
20
112323
5
Address
用戶地址
Varchar
50
sss
√
6
Discription
用戶介紹
Varchar
200
sssss
√
8
jjjjjj
試試看
varchar
122
333
7
hhhh
試試看撒
Varchar
23
111
復(fù)制代碼 代碼如下:
CREATE TABLE T_Test (
userid integer NOT NULL ,
username varchar (50) Default 'Chen' NOT NULL ,
password varchar (30) Default '我的' NOT NULL ,
telephone varchar (20) Default '112323' NOT NULL ,
Address varchar (50) Default 'sss' ,
Discription varchar (200) Default 'sssss' ,
jjjjjj varchar (122) Default '333' NOT NULL ,
hhhh varchar (23) Default '111' NOT NULL
);
ALTER TABLE T_Test add
CONSTRAINT PK_T_Test PRIMARY KEY(userid);
comment on table T_Test is '用戶信息表';
comment on column T_Test.userid is '主鍵ID' ;
comment on column T_Test.username is '用戶名' ;
comment on column T_Test.password is '密碼' ;
comment on column T_Test.telephone is '用戶電話' ;
comment on column T_Test.Address is '用戶地址' ;
comment on column T_Test.Discription is '用戶介紹' ;
comment on column T_Test.jjjjjj is '試試看' ;
comment on column T_Test.hhhh is '試試看撒' ;
新聞熱點
疑難解答
圖片精選