Alter Table Column Primary Key. The SQL query to make column id of table students a PRIMARY KEY is. ALTER TABLE PrimaryKeyColumnAdd ALTER COLUMN Column2 int NOT NULL.
ALTER TABLE mytable DROP PRIMARY KEY ADD PRIMARY KEY col1col2. We can use the ALTER TABLE command to. When more than one fields are used as a primary key the key is called a composite key.
Dont forget that the primary key is a constraint and constraints cannot be altered only dropped and re-created.
Open the Table Designer for the table whose primary key you want to modify right-click in the Table Designer and choose IndexesKeys from the shortcut menu. Modify columns data type. If the changes made or any data is manipulated in any of the tables the changes get reflected in both the tables with the help of foreign key constraint. ALTER TABLE provider DROP PRIMARY KEY ADD PRIMARY KEYperson place thing.