Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to add a primary key to a table - getting error msg

Status
Not open for further replies.

ddiamond

Programmer
Apr 22, 2005
918
US
Platform - AS400

Code:
ALTER TABLE ddiamond.zumyt ADD CONSTRAINT ddiamond.pk_zumyt PRIMARY KEY (myedsg, myedsa)

SQL State: 55019
Vendor Code: -7008
Message: [SQL7008] ZUMYT in DDIAMOND not valid for operation. Cause . . . . . : The reason code is 10. Reason codes are: 1 -- ZUMYT has no members. 2 -- ZUMYT has been saved with storage free. 3 -- ZUMYT not journaled, no authority to the journal, or the journal state is *STANDBY. Files with an RI constraint action of CASCADE, SET NULL, or SET DEFAULT must be journaled to the same journal. 4 and 5 -- ZUMYT is in or being created into production library but the user has debug mode UPDPROD(*NO). 6 -- Schema being created, but user in debug mode with UPDPROD(*NO). 7 -- A based-on table used in creation of a view is not valid. Either the table is program described table or it is in a temporary schema. 8 -- Based-on table resides in a different ASP than ASP of object being created. 9 -- Index is currently held or is not valid. 10 -- A constraint or trigger is being added to an invalid type of table, or the maximum number of triggers has been reached, or all nodes of the distributed table are not at the same release level. 11 -- Distributed table is being created in schema QTEMP, or a view is being created over more than one distributed table. 12 -- Table could not be created in QTEMP, QSYS, QSYS2, or SYSIBM because it contains a column of type DATALINK having the FILE LINK CONTROL option. 13 -- The table contains a DATALINK column or a LOB column that conflicts with the data dictionary. 14 -- A DATALINK, LOB, or IDENTITY column cannot be added to a non SQL table. 15 -- Attempted to create or change an object using a commitment definition in a different ASP. 16 -- Sequence ZUMYT in DDIAMOND was incorrectly modified with a CL command. 17 -- The table is not usable because it contains partial transactions. Recovery . . . : Do one of the following based on the reason code: 1 -- Add a member to ZUMYT (ADDPFM). 2 -- Restore ZUMYT (RSTOBJ). 3 -- Start journaling on ZUMYT (STRJRNPF), get access to the journal, or change the journal state to *ACTIVE (CHGJRN). 4, 5, or 6 -- Perform a CHGDBG command with UPDPROD(*YES). 7 -- Remove table names which identify files in QTEMP or program described files. 8 -- Use tables in the same ASP. 9 -- Use the EDTRBDAP command to change the sequence of the access path from HELD to 1-99 or *OPN, or rebuild or delete the unique index or constraint. 10 -- Specify tables that are valid for constraints or triggers. 11 -- Specify a schema other than QTEMP, or create the view over only one distributed table. 12 -- Specify a schema other than QTEMP, QSYS, QSYS2, or SYSIBM. 13 -- Specify a schema that does not contain a data dictionary or remove all DATALINK and LOB columns. 14 -- Specify an SQL table. 15 -- Specify an object in the same ASP as the current commitment definition or end the current commitment definition. 16 -- Specify a different sequence, or delete the data area associated with sequence ZUMYT in DDIAMOND and recreate the sequence. 17 -- See previous message in the job log.

10 -- A constraint or trigger is being added to an invalid type of table

What would make a table invalid for adding a primary key?
 
Too trivial in your case I guess, but are the fields defined as not nullable?

Ties Blom

 
The fields are defined as not nullable, but they were not nullable in the file I copied from:
Code:
cpyf fromfile(xggndta/zumydf00) tofile(ddiamond/zumyt) crtfile(*yes) ;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top