This code block removed auto increment feature from a primary key auto incremented column.
ALTER TABLE PresetTopic ADD Id2 bigint NULL; GO UPDATE PresetTopic SET Id2 = Id; GO ALTER TABLE QuestionPreset DROP CONSTRAINT FK_QuestionPreset_PresetTopic GO ALTER TABLE PresetTopic DROP CONSTRAINT PK_PresetTopic2 GO ALTER TABLE PresetTopic DROP COLUMN Id; GO EXEC sp_rename 'PresetTopic.Id2', 'Id', 'COLUMN'; GO ALTER TABLE PresetTopic ALTER COLUMN Id BIGINT NOT NULL GO ALTER TABLE PresetTopic ADD PRIMARY KEY (ID); GO
Comments