我做了测试表:
create table tmp (id BIGINT NOT NULL IDENTITY PRIMARY KEY)
现在我想插入一个值:
insert into tmp () values();
它抱怨:
SQL Error [102] [S0001]: Incorrect syntax near ')'.
我无法插入 ID,因为它失败并显示:
insert into tmp (id) values(1);
-- SQL Error [544] [S0001]: Cannot insert explicit value for identity column
-- in table 'tmp' when IDENTITY_INSERT is set to OFF.
DEFAULT
语法 forVALUES
也被禁止:
insert into tmp values(default);
-- SQL Error [8101] [S0001]: An explicit value for the identity column in table 'tmp'
-- can only be specified when a column list is used and IDENTITY_INSERT is ON.