
db2 判断一个表的一个字段是否存在
展开全部
db2 "select 1 from syscat.columns where colname='COL1' and tabname='TAB1' and tabschema='SCH1'"
例如:
db2 "select 1 from syscat.columns where colname='ID' and tabname='STAFF' and tabschema='E97Q9A'"
$ ere colname='ID' and tabname='STAFF' and tabschema='E97Q9A'" <
1
-----------
1
1 record(s) selected.
例如:
db2 "select 1 from syscat.columns where colname='ID' and tabname='STAFF' and tabschema='E97Q9A'"
$ ere colname='ID' and tabname='STAFF' and tabschema='E97Q9A'" <
1
-----------
1
1 record(s) selected.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询