문제

I would like to how can I reset primary key counter in JDBC:Derby from code? I want it reset when I delete database records, but leave tables intact. When I do that, primary key counter does not reset and continue where it ended. I was thinking about something like this

ALTER SEQUENCE <tabname>_<id>_seq RESTART WITH 1

Will this work? And if yes will it work correctly?

도움이 되었습니까?

해결책

This is explained in the columnAlteration section of the ALTER TABLE statement section in the Derby Reference Manual.

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