SQL Server enables or disables auto-growth, SQL Server

Source: Internet
Author: User

SQL Server enables or disables auto-growth, SQL Server

When adding a row to a database table, you need to insert a specific value for the auto-increment column. This function is very useful. For example, the table structure is as follows:

Id | text

1 |

2 | B

4 | d

The id column is a self-contained column. If we want to insert 3 | c, if we do not open the auto-incrementing column, we cannot insert it. At this time, this function will be used.

Copy codeThe Code is as follows: SET IDENTITY_INSERT [Recursive] ON
 
Insert into [Recursive] (id, text) VALUES (3, 'C ')
 
SET IDENTITY_INSERT [Recursive] OFF

We usually use this method when importing data, hoping to help you.

Related Article

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.