mrfangzheng

Hope and fear are useless. Be confident, and always be prepared for the worst.
  首页  :: 新随笔  :: 联系 :: 管理

SQL Server Tricks

Posted on 2008-04-29 15:43  mrfangzheng  阅读(165)  评论(0编辑  收藏  举报
  1. sp_msForEachTable 对每个表进行操作

create table #rowcount (tablename varchar(128), rowcnt int)
exec sp_MSforeachtable
   'insert into #rowcount select ''?'', count(*) from ?'
select * from #rowcount
    order by rowcnt desc
drop table #rowcount