簡單的建立table

2021-05-22 07:21:19 字數 1353 閱讀 2287

--語法:

--create table [database_name.[owner].|owner.]table_name

--(--          指定列名稱,型別

--        [

--            collate]   指定排序規則

--            [

--                 [default constant_expression]  指定預設值

--                 |[identit[seed,increment][not for replication] 指定列為標識列

--            ]

--        ]

--        [rowguidcol]   指定列為全域性識別符號列

--        [...n]   指定列的約束

-----------------------

--     |column_name as computed_column_expression  定義計算列

--     |指定表的約束

--     }

--     |  [,...n]  指定表的主鍵字段

--)--[on]      指定儲存表的檔案組

--[textimage_on]   指定儲存text、ntext和image型別資料的檔案組

--簡易表建立語法--

create table table_name

(column_name datatype  欄位名

|identity(起始值,步長)     自動增長列

|not null|null  空值

|default 預設值

|primary key  --與unique二者定義其一

|unique    -- 與 primary key二者定義其一

)--identity(起始值,步長)     自動增長列   用法說明:

create   table  card1

(卡號 decimal (6) identity(100000,1) primary key not null,

姓名 char(8) null,

專業 char(10) null

)insert into card1

values('1wd','afds')

goselect *

from card1

go--結果

--insert into card1

values('1wdd','afds')

goselect *

from card1

--結果

--

動態建立Table

定義表頭 tablerow trhead new tablerow 定義列 tablecell tchead new tablecell 設定列名 tchead.text 列名1 追加乙個列 trhead.cells.add tchead tchead new tablecell 設定列名 tche...

獲取Table的建立語句

sql指令碼 select case when a.colorder 1 then d.name else end n 表名 a.colorder n 字段序號 a.name n 欄位名 case when columnproperty a.id,a.name,isidentity 1 then e...

標籤table的簡單使用

最外層是用來定義這是乙個table元素 1 1.然後是用來定義列組 嗯 不知道怎麼解釋,反正就是要把col標籤定義在裡面 的屬性 1 2.在colgroup標籤裡面定義col標籤,用來設定每一列的屬性 如width 接下來是用來定義表的頁首 2 1.然後在中插入標籤包裹我們的每一列的標題 2 2.我...