문제

Assuming I have a table with many hundreds of rows (10,000) and I delete rows with Id 500 -> 5,000.

What would happen if I reseed the Id column to 500 when I insert 4,501 new rows?

Is Microsoft SQL server cleaver enough to assign the id 10,001 to the final item I insert, or will it get stuck?

도움이 되었습니까?

해결책

SQL will stuck and insert will fail; also Microsoft doesn't recommend to reseed with a new values witch is less than current.

You might want to copy your data into temp table; truncate (this will reseed value to 0) and insert it back - that will close the gap.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top