Bob Bit
Bob Bit

Reputation: 57

DB2 'list tables' returns nothing found even though there are 50+ tables defined?

This one is most odd, I've got a DB2 instance with 50+ tables defined, and whilst I can insert and query data. DB2 is being extremely picky about formatting and keeps complaining about both table / column context whilst insisting on everything being quoted.

Most weird is that none of the tables show in the results of a 'list tables' command whilst 2 other tables defined by API do..?

Syntax I used to create the tables..

CREATE TABLE Shell.Customers
(
  "idCustomers" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT BY 1  NO CYCLE ORDER ),
  "Name" VARCHAR(64) NOT NULL,
  "Code" VARCHAR(6) NOT NULL,
  PRIMARY KEY ("idCustomers")
) COMPRESS YES ADAPTIVE WITH RESTRICT ON DROP;

Any ideas where I messed it up?

Thanks in advance.. :)

Upvotes: 0

Views: 359

Answers (1)

Mark Barinstein
Mark Barinstein

Reputation: 12314

LIST TABLES command without ‘FOR’ clause shows tables for the current user. Your table is not listed unless your current user name is SHELL.

Use LIST TABLES FOR SCHEMA SHELL (or FOR ALL) command to list the table you mentioned.

Upvotes: 3

Related Questions