Reset List Item ID value numbering at 1
One of the most common problem we face in SharePoint Lists is there is no direct option to reset the value of ListItem ID. In development environment we used to insert and delete lot of test records and during this time ID value automatically increased since ID column is a incrementer type. Finally when we move the site to staging and production environments using backup and restore the ListItem ID value will not start with 1.
But we do not have a OOB option to reset this value. But in the backend content database we can reset this value for any list. The following query will be used to reset value.
UPDATE <Content DB>.dbo.AllListsAux set NextAvailableId=1 where ListID='<GUID>'
Here you can see a table called AllListsAux. This list maintans Item count and Id details for all lists.
Please note we have to be very careful while doing any opertation in backend.
Hope you like this post. :)
But we do not have a OOB option to reset this value. But in the backend content database we can reset this value for any list. The following query will be used to reset value.
UPDATE <Content DB>.dbo.AllListsAux set NextAvailableId=1 where ListID='<GUID>'
Here you can see a table called AllListsAux. This list maintans Item count and Id details for all lists.
Please note we have to be very careful while doing any opertation in backend.
Hope you like this post. :)
Good one..
ReplyDeleteohhhh yeahhh thats the way how its done....
DeleteIt is not recommended to touch SharePoint DB directly. If you touch, MS will not support. Is there any other way to do this(exclusing list template)?
ReplyDeleteYes, you are correct. Unfortunately we do not have any other option to reset ID. Due to this it is always recommended to create lists using list definition so that we can recreate similar list very easily and quickly.
Deleteis it safe ????
ReplyDeleteyes, it is safe. but we have to make sure that list does not contain any data.
ReplyDeleteit is useful post thanks
ReplyDeleteIf I use Sharepoint Online, how works this solution?
ReplyDeleteIt is for only on-premise :)
Delete