SQL:插入指定标识列的数据时候的小错误

异常处理汇总-数据库系列  http://www.cnblogs.com/dunitian/p/4522990.html

后期会在博客首发更新:http://dnt.dkill.net

好久没写标识系列的代码了,刚写就报了个错

SQL:

set identity_insert ShopModelBak on

  insert into ShopModelBak values(5,N'lll',1,1)

set identity_insert ShopModelBak off

咋一看,好像没啥错啊?但是还是报错了:仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表'ShopModelBak'中的标识列指定显式值。

我去,我不是设置了 on 了吗?

在看了看错误信息:::==》仅当使用了列列表

估计的把所有列表写出来,于是试了一试:

set identity_insert ShopModelBak on
  insert into ShopModelBak(SId,SName,SOrder,SDataStatus) values(5,N'lll',1,1)
set identity_insert ShopModelBak off

还真是的。。。。好吧,收工~

posted @ 2016-04-06 14:19  毒逆天  阅读(468)  评论(0编辑  收藏  举报