help.axcms.netAxinom Logo
Save Save Chapter Send Feedback
KB10034: How to update the Sequence if creating new keys manually
If you are creating new objects with keys in the database manually don't forget to change the sequence tables accordingly.

SYMPTOMS

You created new objects in the database manually / with a script. Now if you create a new object from with AxCMS.net, there is a conflict, because AxCMS.net tries to use a key-value which is already in use.

CAUSES

AxCMS.net keeps track of the primary keys used in the database table called Sequence. If it is not updated, AxCMS.net will use a wrong key.

SOLUTION

Update the NextVal column in the Sequence-table manually. If, for example, you added some values to the table AxCategory, run this statement:

UPDATE dbo.[Sequence]
SET NextVal = (SELECT MAX(CategoryID)+1 FROM dbo.AxCategory)
WHERE [Name] = ’Category’

To ensure that AxCMS.net does not use its cached values (table Sequence is cached for better performance), ensure that you restart the application (for example, by saving web.config).

APPLIES TO

AxCMS.net versions: all