34,588
社区成员
发帖
与我相关
我的任务
分享
create table tb(id int,col int)
insert into tb select 1,3 union all select 2,6
go
alter table tb add col1 int not null default 0
go
select * from tb
/*
id col col1
----------- ----------- -----------
1 3 0
2 6 0
(2 行受影响)
*/
go
drop table tb
alter table aa add 列名 int default 0
update aa set 列名=0
update tbname set columnname=0
ALTER TABLE dbo.tbname ADD
columnname int NULL DEFAULT 0
GO