Workarounds for Sybase self-increment field hop numbers

Source: Internet
Author: User
Tags sybase sybase database

Causes and effects of Sybase self-increment field jumps:

In the Sybase database, if the database is turned on, the database service process is forced to end because of an unhealthy cause (freezing, power loss).

Then the auto-growing field will generate a jump, and when inserting records into the data table, the self-increment field jumps to a fairly large value, so that the primary Key's self-increment is likely to be exhausted, or because the value is too large, the data type in the application, such as int, cannot tolerate such a large value. It is not possible to perform related operations within the program.

Sybase self-increment field jump number resolution:

As follows: Sybase executes shutdown with nowait, and then restarts, the original ID value appears in the jump sign.

When you execute shutdown when you close Sybase, there is no hop sign condition.

If no jumps have occurred, you can resolve them as follows:

1. Execute sp_chgattribute table name, ' Identity_gap ', 100

100 of them are based on the sense of a value, in general, the greater the value of the better performance, but the larger the database service process is not normal end, the number of jumps will be greater.

2. If the jump number has occurred, you need to export the table data bcp, and then rebuild the data table, and then execute 1. Then the bcp command imports the data.

Something:

The biggest problem with the Sybase self-increment field is that when the database is re-ported, if it is the data table that is associated with the self-increment primary key, after the data re-import, it is possible that the foreign key of master-slave table cannot be correlated, I did not anticipate this situation at the beginning, it is done, there is no way. It is prudent to use the self-increment field as the primary key later.

"From:http://database.51cto.com/art/201011/235579.htm http://blog.sina.com.cn/s/blog_499ab6b20100xipp.html"

Workarounds for Sybase self-increment field hop numbers

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.