sql – DB2:如何查找表或表列表中是否存在列?
发布时间:2020-12-12 08:33:41  所属栏目:MsSql教程  来源:网络整理 
            导读:我正在使用DB2数据库.什么是合适的SQL查询来查明表或表列表中是否存在列? 例如 if "column_name" is found in "table name" or [list of table names]return true or the name of tables that have that column. 非常感谢. 解决方法 使用 SYSCAT.COLUMNS cat
                
                
                
            | 
                        我正在使用DB2数据库.什么是合适的SQL查询来查明表或表列表中是否存在列? 
  
  例如 if "column_name" is found in "table name" or [list of table names] return true or the name of tables that have that column. 非常感谢. 解决方法使用SYSCAT.COLUMNS catalog view: 
  
  
 SELECT TABNAME
FROM SYSCAT.COLUMNS
WHERE 
    TABNAME IN ('table name 1','table name 2') AND 
    COLNAME = 'column_name';                        (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!  | 
                  
