您的位置:首页 > 数据库

sql server查询数据库总数据条数

2017-10-13 15:10 239 查看
1:

select  

        sum(c.row_count) as datacount  

from    sys.indexes a ,  

        sys.objects b ,  

        sys.dm_db_partition_stats c  

where   a.[object_id] = b.[object_id]  

        AND b.[object_id] = c.[object_id]  

        AND a.index_id = c.index_id  

        AND a.index_id < 2  
        AND b.is_ms_shipped = 0 

2:

select  b.name as tablename ,  

        a.rowcnt as datacount  

from    sysindexes a ,  

        sysobjects b  

where   a.id = b.id  

        and a.indid < 2  

        and objectproperty(b.id, 'IsMSShipped') = 0 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐