Skip to content

Instantly share code, notes, and snippets.

@pallid
Last active November 10, 2015 09:35
Show Gist options
  • Save pallid/6dbefe1b428d0d5070f5 to your computer and use it in GitHub Desktop.
Save pallid/6dbefe1b428d0d5070f5 to your computer and use it in GitHub Desktop.
Информация по базам от Ромы
set nocount on
declare @res varchar(max)
declare @st table ([Database Name] varchar(100), [Log Size (MB)] real, [Log Space Used (%)] real, [Status] real)
insert into @st ([Database Name], [Log Size (MB)], [Log Space Used (%)], [Status])
exec('DBCC SQLPERF(LOGSPACE)')
declare @l int
select @l=max(len([Database Name])) from @st
set @res='[Database Name]'+Replicate(' ',@l-len('[Database Name]'))+' [Log Size (MB)] [Log Space Used (%)] [Status]'+char(13)
select @res=@res+[Database Name]+Replicate(' ',@l-len([Database Name]))+' ' +str([Log Size (MB)],15,2)+' '+str([Log Space Used (%)],18,1)+' '+str([Status],8)+char(13) from @st
select @res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment