/* select
t.name table_name,s.name schema_name,sum(p.rows) total_rows
from
sys.tables t
join sys.schemas s on (t.schema_id = s.schema_id)
join sys.partitions p on (t.object_id = p.object_id)
where p.index_id in (0,1)
group by t.name,s.name
having sum(p.rows) > 100;
 
查询行数>100的表。若=0,则为查询空表 */

 

/* select object_name(id) objName,Name as colName
from syscolumns
where (name like'%Id%')
and id in(select id from sysobjects where xtype='u')
order by objname;
查询某列在哪些表里存在。
*/

来自:https://www.cnblogs.com/lotoblog/p/16164430.html