You can specify an explicit value problem for an identity column in a table only if a list of columns is used and IDENTITY_INSERT is on

Source: Internet
Author: User

Today, when dealing with a database, this problem is inserting a data into a table

The system reported such errors

You can specify an explicit value problem for an identity column in a table only if a list of columns is used and IDENTITY_INSERT is on

Table has a column that is self-growing identity column "Field 1"

If this is inserted

SET Identity_insert platform. As_userinfo on

INSERT into platform. As_userinfo values (' 110 ', ' Zhang Fei ', ' Male ', 20120401, 18, ' League members ', 2008-3-1)

SET Identity_insert platform. As_userinfo OFF

The system will report such errors. You can specify an explicit value problem for an identity column in a table only if the list of columns is used and IDENTITY_INSERT is on

After specifying the column list, you can insert the data normally, which means that the indicated field must be listed one at a to be inserted normally, as follows:

SET Identity_insert platform. As_userinfo on

INSERT into platform. As_userinfo (field 1, Field 2, Field 3, Field 4, Field 5, field 6) VALUES (' 110 ', ' Zhang Fei ', ' Male ', 20120401, 18, ' League members ', 2008-3-1)

SET Identity_insert platform. As_userinfo OFF

You can specify an explicit value problem for an identity column in a table only if a list of columns is used and IDENTITY_INSERT is on

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.