-------查询一个表有多少列
select count(*) from sysobjects a join syscolumns b
on a.id=b.id
where a.name='XXX'
-----查询一个数据库中有多少张表
SQLSERVER:SELECT * from sysobjects where xtype = 'u'
ORACLE: select * from user_tables
------查询一个库中所有含有某列名的表
select distinct t1.name from sysobjects t1,syscolumns t2
where t1.id=t2.id and t2.name like '%name%'