当IDENTITY_INSERT设置为OFF时,无法在表'bill'中为identity列插入显式值。 [英] Cannot insert explicit value for identity column in table 'bill' when IDENTITY_INSERT is set to OFF.

查看:96
本文介绍了当IDENTITY_INSERT设置为OFF时,无法在表'bill'中为identity列插入显式值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决这个错误,我正在开发账单s / w这里我使用账单号码的身份。但错误是如何解决这个错误任何人指导我。



当IDENTITY_INSERT设置为OFF时,无法在表'bill'中为identity列插入显式值。



这是我的SQL查询



SET IDENTITY_INSERT账单插入账单(staffid,cstid,cstname) ,方案,counum,RECNUM,日期,slno,proname,价格,数量,protax,DIS,AMT)的值(@ STAFFID,@ cstid,@ cstname,@方案,@ counum,@ RECNUM,@日期,@ slno,@代名词,@价格,@数量,@ protax,@ dis,@ amt)SET IDENTITY_INSERT账单关闭



我尝试了什么:



当IDENTITY_INSERT设置为OFF时,无法在表'bill'中为identity列插入显式值。

解决方案

您可以尝试:

  ALTER   TABLE  YourTableName  NOCHECK   CONSTRAINT  YourConstraint 



请参阅: SQL SERVER - 如何禁用和启用表和数据库的所有约束 - 使用Pinal Dave访问SQL权限 [ ^


How to solve this error, i am developing billing s/w here i am using identity for bill number. But error is came how to solve this error Any one guide me.

Cannot insert explicit value for identity column in table 'bill' when IDENTITY_INSERT is set to OFF.

This is for my SQL Query

SET IDENTITY_INSERT bill ON insert into bill(staffid,cstid,cstname,schemes,counum,recnum,date,slno,proname,price,qty,protax,dis,amt)values(@staffid,@cstid,@cstname,@schemes,@counum,@recnum,@date,@slno,@proname,@price,@qty,@protax,@dis,@amt)SET IDENTITY_INSERT bill OFF

What I have tried:

Cannot insert explicit value for identity column in table 'bill' when IDENTITY_INSERT is set to OFF.

解决方案

You could try:

ALTER TABLE YourTableName NOCHECK CONSTRAINT YourConstraint


See: SQL SERVER - How to Disable and Enable All Constraint for Table and Database - Journey to SQL Authority with Pinal Dave[^]


这篇关于当IDENTITY_INSERT设置为OFF时,无法在表'bill'中为identity列插入显式值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆