[英]SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=SYSCAT.COLUMNS, DRIVER=3.54.54
Hi i'm trying to find column count for a db2 table. 嗨,我正在尝试查找db2表的列数。 I have schema name and table name details. 我有架构名称和表名称的详细信息。 Tried with 尝试过
select COUNT(*) from SYSCAT.COLUMNS WHERE TABNAME = 'ABC' and TABSCHEMA='XYZ'
AND 和
SELECT COUNT(*) FROM sys.columns WHERE object_id = OBJECT_ID('ABC')
But unfortunately both of them are throwing errors. 但是不幸的是,他们两个都抛出错误。
Need suggestions with my issue of finding column count for a table in db2 database 需要有关在db2数据库中查找表的列数的问题的建议
Hi finally i was able to fix this issue by modifying my query to 嗨,终于,我能够通过修改查询来解决此问题
select count(*) from sysibm.syscolumns where tbname = 'ABC' and TBCREATOR = 'XYZ'
where TBCREATOR is the schema name and tbname is the table name. 其中,TBCREATOR是架构名称,tbname是表名称。
this code work on system i (AS400...) 此代码在系统i(AS400 ...)上有效
select * from qsys2.syscolumns
where COLUMN_NAME='YOURCOLUMNNAME'
and TABLE_NAME='YOURTABLENAME' and TABLE_SCHEMA='YOURLIB'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.