alter table abc add id int default 0 update abc set id=0
alter table abc add id int default 0 只有新增记录时才有用
alter table abc add id int default 0 只有新增记录时才有用
alter table abc add id int default 0 not null
create table abc(name nvarchar(10)) insert abc select '1' union all select '2' union all select '3' union all select '4' union all select '5' alter table abc add id int not null default(0)select * from abcname id ---------- ----------- 1 0 2 0 3 0 4 0 5 0(5 row(s) affected)
update abc set id=0
只有新增记录时才有用
只有新增记录时才有用
create table abc(name nvarchar(10))
insert abc
select '1' union all
select '2' union all
select '3' union all
select '4' union all
select '5' alter table abc add id int not null default(0)select * from abcname id
---------- -----------
1 0
2 0
3 0
4 0
5 0(5 row(s) affected)