sqlI have a table in Microsoft SQL Server where insert or updates isn’t possible. Table is only responsible to increment a unique id.

The table looks like this:

CREATE TABLE [dbo].[CustomerOrderNumbers](
[customerOrderNumberId] [int] IDENTITY(1,1) NOT NULL,
[createdOn] [datetime] NOT NULL,
[isDeleted] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
[customerOrderNumberId] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[CustomerOrderNumbers] ADD DEFAULT (getdate()) FOR [createdOn]
GO

ALTER TABLE [dbo].[CustomerOrderNumbers] ADD DEFAULT ((0)) FOR [isDeleted]

But how do you increase the primary key when you can’t insert any values?

Answer, insert default value:
INSERT INTO [CustomerOrderNumbers] DEFAULT VALUES

This command also works with Azure SQL database.