16
Views
4
Comments
Solved
Reset the the primary key to start from 200

how to restart the primary key of a table to start from 200 !! 

i have tried below 


  ALTER SEQUENCE  [OutSystems_prod].[dbo].[Table_Name].[Id]

    RESTART WITH 200

    INCREMENT BY 1  


but i got this error 

Msg 166, Level 15, State 1, Line 79

'CREATE SEQUENCE' does not allow specifying the database name as a prefix to the object name.



Solution

Hi,

OutSystems doesn't allow you to change the sequence of a primary key.

The only option you would have to start the sequence from 1 again, is to cut and paste the entity in your module, as OutSystems will then generate a new entity again. Be aware of the impact of your application data if there is referential data.

Ps. Why does it matter that is skipped numbers, the numbers should have no meaning other than that they are a unique number. 

Regards,

Daniel

this one works your excellency 


DBCC CHECKIDENT('Table Name', RESEED, 200)

On a database managed by OutSytems in the cloud?

the number jump from 173 to 10173 i want to restart the sequence to 174 please how to do that !!


Solution

Hi,

OutSystems doesn't allow you to change the sequence of a primary key.

The only option you would have to start the sequence from 1 again, is to cut and paste the entity in your module, as OutSystems will then generate a new entity again. Be aware of the impact of your application data if there is referential data.

Ps. Why does it matter that is skipped numbers, the numbers should have no meaning other than that they are a unique number. 

Regards,

Daniel

this one works your excellency 


DBCC CHECKIDENT('Table Name', RESEED, 200)

On a database managed by OutSytems in the cloud?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.