0

Using DB2 for z/OS v.10, I'm getting an error when I specify a tablespace when using CREATE TABLE ... LIKE.

I can successfully use CREATE TABLE ... LIKE if I don't specify a new tablespace, but it throws an error when I specify a tablespace. The manual seems to say that this should work, but I must have an error in the syntax.

Create Table MySchema.Deleteme2
  Like MySchema.Deleteme;

Table MYSCHEMA.DELETEME2 created.

Create Table MySchema.Deleteme2
  Like MySchema.Deleteme
    in MYDB.SOMETS
;

THE STATEMENT COULD NOT BE PROCESSED BECAUSE ONE OR MORE IMPLICITLY CREATED OBJECTS ARE INVOLVED 1.

Any ideas?

Thank you for your help!

Dave

Dave Ford
  • 341
  • 2
  • 14
  • Note that I did drop the table between the two CREATE's. – Dave Ford Nov 17 '20 at 18:25
  • 1
    Has the target tablespace already been correctly created with appropriate attributes and permissions? – mao Nov 17 '20 at 18:28
  • @mao, thanks for your comment! I checked the target tablespace, and it does exist. Since your comment got me to thinking more, I manually created another tablespace, and the previously-described CREATE TABLE ... LIKE statement worked beautifully with the newly-created one. Therefore, I'm guessing that the attributes of the original tablespace are not compatible with this new table. Perfect! Thanks again! – Dave Ford Nov 17 '20 at 19:11

1 Answers1

1

Resolved by ensuring that the target tablespace was first created with the correct attributes and permissions, before running the create table .... like ... in ...

mao
  • 11,321
  • 2
  • 13
  • 29