查询数据库中数据表的数据条数
DECLARE @ClientIP varchar(30),@ServerIP varchar(30),@ClientName nvarchar(100),@ServerName nvarchar(100),@DbName nvarchar(50) select @ServerIP = local_net_address, @ClientIP = client_net_address,@DbName = db_name(), @ClientName = HOST_NAME(),@ServerName = @@servername from sys.dm_exec_connections where Session_id=@@spid SELECT @ServerIP, @ServerName,@ClientIP,@ClientName ,@DbName,a.name,convert(bigint,b.rows) TotalCount,convert(nvarchar(100),D.Description) FROM sysobjects a INNER JOIN sysindexes b ON a.id=b.id join ( select a.name AS name,isnull(g.[value], '未定义') AS Description from sys.tables a left join (SELECT * FROM sys.extended_properties WHERE NAME='Description' ) g on (a.object_id = g.major_id AND g.minor_id = 0) ) D ON D.name = A.name WHERE b.indid IN(0,1) AND a.Type='U' ORDER BY b.rows desc