create database temp
on primary
(
name=temp,
filename='d:\temp.mdf',
size=3,
maxsize=unlimited,
filegrowth=10%
)
log on
(
name=temp_log,
filename='d:\temp_log.ldf',
size=3,
maxsize=unlimited,
filegrowth=10%
)
create table temp.dbo.temp
(
s_id int identity(1,1) not null,
s_sex char(2),
s_age int
)
use temp
insert temp (s_id,s_sex,s_age) values(1,'男',23)         --这行出错了出错代码
消息 544,级别 16,状态 1,第 2 行
当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'temp' 中的标识列插入显式值。

我发现凡是字段为标识列的,都不好用,由于标识列不能为空,难道不能insert插入记录到表中???