eg: create table a ( id int not null ) insert into a select null 插入数据时会出错 Msg 515, Level 16, State 2, Line 1 Cannot insert the value NULL into column 'id', table 'SECFilingData.dbo.a'; column does not allow nulls. INSERT fails. 此时要么输入数据不为空,要么alter table a alter column id int null后再插入数据 联机丛书上有很多例子的
create table a
(
id int not null
)
insert into a
select null
插入数据时会出错
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'id', table 'SECFilingData.dbo.a'; column does not allow nulls. INSERT fails.
此时要么输入数据不为空,要么alter table a alter column id int null后再插入数据
联机丛书上有很多例子的