I'm at a dead end
I am trying to change the value of the Identity column increment in a collection of existing MS SQL tables (which all have data) and trying to investigate whether I can do without writing special scripts for each table. I cannot find a solution that does not require dropping and re-creating tables, each table of which requires a different script, since each of them has different column columns.
For example, I want to modify an existing table
CREATE TABLE [dbo].[ActionType](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Action] [varchar](100) NOT NULL,
CONSTRAINT [PK_ActionType] PRIMARY KEY CLUSTERED
(
[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
For
CREATE TABLE [dbo].[ActionType](
[ID] [int] IDENTITY(1,5) NOT NULL,
[Action] [varchar](100) NOT NULL,
CONSTRAINT [PK_ActionType] PRIMARY KEY CLUSTERED
(
[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
Through something like
exec sp_AlterIncrement @TABLE_NAME = 'ActionType', @NEW_ICREMENT = 5
Saving data.
This will fix the big deployment problem that I am facing right now, so any help would be appreciated
source
share