SQL 添加字段和默认值脚本

时间:2022-05-20 09:49:39

--插入字段和默认值
alter table Acc_WayBill
add DeclaredValue nvarchar(50)
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'申明价值' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Acc_WayBill', @level2type=N'COLUMN',@level2name=N'DeclaredValue'
GO

alter table Acc_WayBill
add PackingWay int
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'包装方式(0纸箱、1木箱、2其它)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Acc_WayBill', @level2type=N'COLUMN',@level2name=N'PackingWay'
GO

--单独插入字段默认值
alter table Acc_WayBillBackBillDetails add DEFAULT 0 for IsReceipt