patternMinor
SQL0204N "DB2ADMIN.TA" is an undefined name. SQLSTATE=42704
Viewed 0 times
undefineddb2adminnamesqlstatesql0204n42704
Problem
There is a table called
When I ran
However, when I ran the query
SQL0204N "DB2ADMIN.TA" is an undefined name. SQLSTATE=42704
What is the reason for this?
ta with schema db2admin.When I ran
db2 select tabname,tabschema from syscat.tables wheretabname='ta' and tabschema='db2admin', it returned the row, which means the table was there.However, when I ran the query
db2 select * From db2admin.ta under the same user account, this error was raised:SQL0204N "DB2ADMIN.TA" is an undefined name. SQLSTATE=42704
What is the reason for this?
Solution
DB2 (as other standard-compliant SQL databases) converts unquoted identifiers to uppercase, so when you say
According to the
Note the double quotes.
select * from db2admin.ta DB2 will look for the table named 'TA' in the schema 'DB2ADMIN'. That's exactly what the error message tells you.According to the
SYSCAT.TABLES query results, you have created your table and schema with lowercase names. To access them you will need to quote both identifiers (separately):select * from "db2admin"."ta"Note the double quotes.
Code Snippets
select * from "db2admin"."ta"Context
StackExchange Database Administrators Q#160461, answer score: 4
Revisions (0)
No revisions yet.