SQL Server modifies the identity column methods such as self-added batch modification _mssql

Source: Internet
Author: User
Through the interface design is able to manually operate, can not achieve my batch modification thousands of servers.
Because of this a foot would have been executed in bulk.
Environment: Redgate + MSSQL 2008 R2
The following code is used as a minor modification to your business.
Copy Code code as follows:

--Allows system tables to be updated
EXEC sp_configure ' allow updates ', 1
Reconfigure with override
Go
--Suppress identity column tags
Update syscolumns Set colstat = 0 WHERE id = object_id (' tablename ') and Colstat = 1
Go
--Insert the id=8001-8003 line
--Restore identity column tags
Update syscolumns Set Colstat = 1 WHERE id = object_id (' tablename ') and name = ' identity column name '
--Reset the starting value of the identity
DBCC checkident (table name, Reseed, 10003)
--Disable updating of system tables
EXEC sp_configure ' allow updates ', 0
Reconfigure with override

There is a lot of bulk operation Knowledge,
If the index is accurate in bulk check
Is the length of the field consistent
Does the job run the same result
Whether the service starts at the same time
......
All need to be processed in batches.
Refer to my other articles for additional bulk operations.
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.