create table 表名(
SysNo int identity(1,1) primary key not null,--字段名 类型 是否可空 默认值,
Name nvarchar(50)null,
CreateUserSysNo int not nulldefault(0),
CreateTime datetime not nulldefault(getdate()),
LastUpdateUserSysNo int not nulldefault(0),
LastUpdateTime datetime not nulldefault(getdate()))
添加新的字段
alter table 表名 add 字段名 类型 可空 默认值
alter table Compact_Master add PaymentType int null
alter table LimitBuyQuantity add EndTime datetime not nulldefault(getdate())
更新字段 名称/类型
alter table 表名alter column 字段名 更改后的类型
alter table LimitBuyQuantity alter column Tips nvarchar(30)