1

This db2 query:

alter table mylib.mytable add primary key(field1, field2, field3)

returns

[SQL0624] Table MYTABLE in MYLIB already has a primary key'.

However

alter table mylib.mytable drop primary key

returns:

[SQL0539] Table MYTABLEin MYLIB does not have a primary or unique key'.

How can I remove the existing primary key and create the new one?

The file was created in green screen, not by executing a SQL CREATE TABLE. The database version is V7R2.

McNets
  • 23,979
  • 11
  • 51
  • 89
Test User
  • 65
  • 1
  • 5

1 Answers1

0

You can find all FKEY/PKEY/CHECK Constraints in QSYS2.TABLE_CONSTRAINTS to see and/or remove any keys built on the table.

Michael S.
  • 14
  • 5