如果想要给标识列显示的添加数据,可以使用如下的方法:

set identity_insert  PCInfo on--设置标识列可以显示添加数据
insert into PCInfo(PCId,PCUse,PCNote) values(100,1,'aaa')--PCId为标识列
set identity_insert  PCInfo off--设置标识列不可以显示添加数据

注意:要想显示的为某表的标识列显示添加数据,在insert语句中一定要在表后面显示要添加的字段,

如:PCInfo(PCId,PCUse,PCNote),如果只写PCInfo仍然不能为PCId显示的添加数据

posted on 2012-05-18 15:06  aparche  阅读(11353)  评论(0编辑  收藏  举报