日期:2014-05-19  浏览次数:20410 次

速求一个insert 语句
我有一个表。仅一个自增长字段
CREATE   TABLE   [ChangeObjectInterface]   (
[id]   [int]   IDENTITY   (1,   1)   NOT   NULL   ,
CONSTRAINT   [PK_ChangeObjectInterface]   PRIMARY   KEY     CLUSTERED  
(
[id]
)     ON   [PRIMARY]  
)   ON   [PRIMARY]
GO


请问如何向他进行插入

------解决方案--------------------
set identity_insert ChangeObjectInterface on
INSERT INTO [ChangeObjectInterface]([id])
VALUES(1)
set identity_insert ChangeObjectInterface off

/*

(所影响的行数为 1 行)

*/
------解决方案--------------------
关注
------解决方案--------------------
--允许将显式值插入表的标识列中。
set identity_insert changeobjectinterface on

insert into [changeobjectinterface]([id]) values(1)

set identity_insert changeobjectinterface off