use master
declare @dataName varchar(50)
declare @sql varchar(2000)
set @dataName='N3DB_Goodee'
SELECT @dataName as ' ',@@MAX_CONNECTIONS as '允许同时用户连接的最大数',COUNT(*) as '当前连接数' FROM master.dbo.sysprocesses WHERE dbid IN (SELECT dbid FROM master.dbo.sysdatabases WHERE NAME=@dataName)
--SELECT status as '状态',* FROM master.dbo.sysprocesses WHERE dbid IN (SELECT dbid FROM master.dbo.sysdatabases WHERE NAME=@dataName)
SELECT status as '状态',* FROM master.dbo.sysprocesses
WHERE DB_NAME(dbid) = @dataName and status <> 'sleeping'
ORDER BY status
exec ('select ''操作日志数量'' as '' '', count(1) as '' '' from ' + @dataName + '..Log')
exec ('select ''审批记录数量'' as '' '', count(1) as '' '' from ' + @dataName + '..ApprovalHistory')
exec ('select * from ' + @dataName + '..Log order by ID desc')
--exec ('delete from ' + @dataName + '..Log')
--exec ('delete from ' + @dataName + '..ApprovalHistory')
declare @dataName varchar(50)
declare @sql varchar(2000)
set @dataName='N3DB_Goodee'
SELECT @dataName as ' ',@@MAX_CONNECTIONS as '允许同时用户连接的最大数',COUNT(*) as '当前连接数' FROM master.dbo.sysprocesses WHERE dbid IN (SELECT dbid FROM master.dbo.sysdatabases WHERE NAME=@dataName)
--SELECT status as '状态',* FROM master.dbo.sysprocesses WHERE dbid IN (SELECT dbid FROM master.dbo.sysdatabases WHERE NAME=@dataName)
SELECT status as '状态',* FROM master.dbo.sysprocesses
WHERE DB_NAME(dbid) = @dataName and status <> 'sleeping'
ORDER BY status
exec ('select ''操作日志数量'' as '' '', count(1) as '' '' from ' + @dataName + '..Log')
exec ('select ''审批记录数量'' as '' '', count(1) as '' '' from ' + @dataName + '..ApprovalHistory')
exec ('select * from ' + @dataName + '..Log order by ID desc')
--exec ('delete from ' + @dataName + '..Log')
--exec ('delete from ' + @dataName + '..ApprovalHistory')