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

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显示的添加数据

相关文章:

  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-20
  • 2022-02-20
  • 2022-12-23
  • 2021-10-22
  • 2022-03-02
相关资源
相似解决方案