﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Anand Mahendra  / sp_import_errorlog / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 00:34:00 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: sp_import_errorlog</title><link>http://www.sqlservercentral.com/Forums/Topic556378-1368-1.aspx</link><description>[quote][b]juanfcoy (8/21/2008)[/b][hr]...Although, a tool I have been using to read/query SQL Logs and all other relevant OS logs is Microsoft's Log Parser 2.x. .... [/quote]Indeed, but some people prefer using the "known software"s tools ;)We mainly use Log Parser to import e.g. print server event logs into a sqlserver table because that is a huge volume of date.</description><pubDate>Thu, 21 Aug 2008 08:04:10 GMT</pubDate><dc:creator>ALZDBA</dc:creator></item><item><title>RE: sp_import_errorlog</title><link>http://www.sqlservercentral.com/Forums/Topic556378-1368-1.aspx</link><description>Good tool to have! Thanks for posting.Although, a tool I have been using to read/query SQL Logs and all other relevant OS logs is Microsoft's Log Parser 2.x. That is a great tool that will spare you from having to import the log into a table in order to query. Cheers!:)</description><pubDate>Thu, 21 Aug 2008 07:52:45 GMT</pubDate><dc:creator>juanfcoy</dc:creator></item><item><title>RE: sp_import_errorlog</title><link>http://www.sqlservercentral.com/Forums/Topic556378-1368-1.aspx</link><description>Nice examples ...</description><pubDate>Thu, 21 Aug 2008 04:50:06 GMT</pubDate><dc:creator>Anipaul</dc:creator></item><item><title>RE: sp_import_errorlog</title><link>http://www.sqlservercentral.com/Forums/Topic556378-1368-1.aspx</link><description>Nice proc.In SQL2005 access to the errorlog are restriced.Because some of my developers "realy" needed errorlog info, I've come up with this alternative. I just import the errorlog using a sqlagent job on a regular bases (1h)using this proc.[code]/* * ALZDBA dd 20070605 * Because sp_readerrorlog needs securityadmin authority to be run, we've created this alternative*/use Mastergo/* drop table  dbo.T_DBA_SQLServerErrorlog*/if object_id('dbo.T_DBA_SQLServerErrorlog') is nullbegin	create table T_DBA_SQLServerErrorlog (		RowNumber int identity(1,1) primary key not null,		LogDate  datetime not null,		ProcessInfo sysname not null,		[Text] varchar(max),		DtTableRefresh datetime not null default getdate()		)	-- grant select on dbo.T_DBA_SQLServerErrorlog to [Server_Dev_group]goendgoif object_id('spc_DBA_RefreshErrorlogData') is not null begin   drop procedure spc_DBA_RefreshErrorlogDataendgoCreate proc spc_DBA_RefreshErrorlogDataasbeginset nocount on/* * clear old data*/truncate table dbo.T_DBA_SQLServerErrorlog/* * load new data*/insert into dbo.T_DBA_SQLServerErrorlog (LogDate, ProcessInfo, [Text])	exec sys.sp_readerrorlogendGOif object_id('sp_DBA_ErrorlogData') is not null begin   drop procedure sp_DBA_ErrorlogDataendgoCreate proc sp_DBA_ErrorlogDataasbegin	select *	from dbo.T_DBA_SQLServerErrorlogendgo/* * Schedule job to refresh data hourly*/USE [msdb]GO/****** Object:  Job [DBA_RefreshErrorlogData]    Script Date: 06/05/2007 14:02:57 ******/BEGIN TRANSACTIONDECLARE @ReturnCode INTSELECT @ReturnCode = 0/****** Object:  JobCategory [Database Maintenance]    Script Date: 06/05/2007 14:02:58 ******/IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'Database Maintenance' AND category_class=1)BEGINEXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=N'Database Maintenance'IF (@@ERROR &amp;lt;&amp;gt; 0 OR @ReturnCode &amp;lt;&amp;gt; 0) GOTO QuitWithRollbackENDDECLARE @jobId BINARY(16)EXEC @ReturnCode =  msdb.dbo.sp_add_job @job_name=N'DBA_RefreshErrorlogData', 		@enabled=1, 		@notify_level_eventlog=2, 		@notify_level_email=0, 		@notify_level_netsend=0, 		@notify_level_page=0, 		@delete_level=0, 		@description=N'No description available.', 		@category_name=N'Database Maintenance', 		@owner_login_name=N'sa', @job_id = @jobId OUTPUTIF (@@ERROR &amp;lt;&amp;gt; 0 OR @ReturnCode &amp;lt;&amp;gt; 0) GOTO QuitWithRollback/****** Object:  Step [spc_DBA_RefreshErrorlogData]    Script Date: 06/05/2007 14:02:58 ******/EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'spc_DBA_RefreshErrorlogData', 		@step_id=1, 		@cmdexec_success_code=0, 		@on_success_action=1, 		@on_success_step_id=0, 		@on_fail_action=2, 		@on_fail_step_id=0, 		@retry_attempts=0, 		@retry_interval=0, 		@os_run_priority=0, @subsystem=N'TSQL', 		@command=N'EXEC dbo.spc_DBA_RefreshErrorlogData', 		@database_name=N'master', 		@flags=0IF (@@ERROR &amp;lt;&amp;gt; 0 OR @ReturnCode &amp;lt;&amp;gt; 0) GOTO QuitWithRollbackEXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1IF (@@ERROR &amp;lt;&amp;gt; 0 OR @ReturnCode &amp;lt;&amp;gt; 0) GOTO QuitWithRollbackEXEC @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id=@jobId, @name=N'Dagelijks_Ieder_Kwartier', 		@enabled=1, 		@freq_type=4, 		@freq_interval=1, 		@freq_subday_type=4, 		@freq_subday_interval=15,		@freq_relative_interval=0, 		@freq_recurrence_factor=0, 		@active_start_date=20070605, 		@active_end_date=99991231, 		@active_start_time=2, 		@active_end_time=235959IF (@@ERROR &amp;lt;&amp;gt; 0 OR @ReturnCode &amp;lt;&amp;gt; 0) GOTO QuitWithRollbackEXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, @server_name = N'(local)'IF (@@ERROR &amp;lt;&amp;gt; 0 OR @ReturnCode &amp;lt;&amp;gt; 0) GOTO QuitWithRollbackCOMMIT TRANSACTIONGOTO EndSaveQuitWithRollback:    IF (@@TRANCOUNT &amp;gt; 0) ROLLBACK TRANSACTIONEndSave:[/code]</description><pubDate>Thu, 21 Aug 2008 04:22:24 GMT</pubDate><dc:creator>ALZDBA</dc:creator></item><item><title>sp_import_errorlog</title><link>http://www.sqlservercentral.com/Forums/Topic556378-1368-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/sp_import_errorlog/63565/"&gt;sp_import_errorlog&lt;/A&gt;[/B]</description><pubDate>Thu, 21 Aug 2008 04:09:48 GMT</pubDate><dc:creator>anand mahendra</dc:creator></item></channel></rss>