proc to order xp_enumerrorlog

,

this is a quick stored procedure I put together when trying to find a log for a particular day (xp_enumerrorlogs returns the archive is as a varchar, so 1 is followed by 11, 12 etc rather than 2)
sp_display_errorlogs with no parms returns output in archive id order. if the parm 'size' is passed in, the rows are returned in descending size order

create procedure sp_display_enumerrorlogs @size varchar(10) = 'nosize'
as
-- usage sp_display_enumerrorlogs  ['size']
-- this procedure has been tested on sql server 2000 sp4 and SQL Server 2005 sp2
-- any problems email pgr_consulting @ yahoo.com

create table #enumerrorlogs (archive_number int, archive_date datetime, file_size_bytes int)

insert #enumerrorlogs execute xp_enumerrorlogs

if @size = 'nosize'
begin

	select * from #enumerrorlogs
	order by archive_number
end
else
begin
	select * from #enumerrorlogs
	order by file_size_bytes desc
end
drop table #enumerrorlogs
go

Rate

Share

Share

Rate