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),'数据来源:SqlServer定时计划任务'
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
SqlServer 查询 数据库中 所有表的 总条数 (总记录数)
查询结果:
猜你喜欢
转载自blog.csdn.net/CsethCRM/article/details/108128100
今日推荐
周排行