removing,auto,increment,feature,from,column,sql,primary,key

Kubilay 1/21/2019 0

This code block removed auto increment feature from a primary key auto incremented column.

PL/SQL
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 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments