I’ve a sql table with a primary key(Auto Incremented) and a foreign key.Now I need to modify the table by modifying the foreign key to second primary key so that its values are not allowed to duplicate.
How do i alter my table without affecting the data? Need the sql code.
Regards,
Vix
If I understand your request, you want to force the foreign key to be unique within the given table so your schema looks like:
And you now want to force ForeignId to be unique in this table, correct? You would do the following: