I get a SQL5051 error when I try to alter a table to include PK's. My syntax is as follows :
ALTER TABLE <LIBRARY_NAME.TABLE_NAME>
ADD CONSTRAINT <PK_NAME> PRIMARY KEY
I am using JDBC (IBM Toolbox for Java) on a DB2/400 V5R1.
I checked the documentation and it specified the following:
"A constraint name was qualified by a name that is not the same as the qualifier for the table. A constraint for a table must be qualified by the same collection as the table. If not explicitly qualified, a constraint name is implicitly qualified by the default collection ID, if one is specified. Otherwise, the constraint name is implicitly qualified by the authorization ID for SQL names and by the qualifier of the table name for system names. "