SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


xp_readerrorlog


xp_readerrorlog

Author
Message
DBA_123
DBA_123
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 165
Hi, I'm trying to search a logfile with xp_readerrorlog for certain text but i would like to exclude databases starting with letter B for example. Does anyone know if this i possible with xp_readerrorlog?
Lowell
Lowell
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29118 Visits: 39984
xpreaderrorlog doesn't have a column dedicated to the database name, so no, there's no way to filter based on a LIKE statement directly.

there's a pretty good recap of the parameters and usage here:
[b]http://blog.sqltechie.com/2011/03/xpreaderrorlog-parameter-detail.html

i would simply stick all the results into a temp table, and then filter the results from there;
something like this looks right to me and my preliminary test:


[#RESULTS]
drop table[#RESULTS]
CREATE TABLE [dbo].[#RESULTS] (
[RESULTSID] INT IDENTITY(1,1) NOT NULL,
[LOGDATE] DATETIME NULL,
[PROCESSINFO] VARCHAR(128) NULL,
[XPTEXT] VARCHAR(max) NULL)

INSERT INTO #RESULTS([LOGDATE] ,[PROCESSINFO],[XPTEXT])
EXEC Xp_readerrorlog 0

SELECT DISTINCT #RESULTS.*
--dbz.*
FROM #RESULTS
left outer join(SELECT name from sys.databases where name like 'D%') dbz
ON CHARINDEX(dbz.name,#RESULTS.XPTEXT) = 0



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Joie Andrew
Joie Andrew
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2403 Visits: 2032
Hi, I'm trying to search a logfile with xp_readerrorlog for certain text but i would like to exclude databases starting with letter B for example. Does anyone know if this i possible with xp_readerrorlog?


Are you trying to read a database transaction log, or the SQL Error Log? xp_readerrorlog is meant for reading the SQL Error Log.

Joie Andrew
"Since 1982"
sandos
sandos
Grasshopper
Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)

Group: General Forum Members
Points: 20 Visits: 124
You can execute the below specifying the search string.

EXEC master.dbo.xp_readerrorlog 0, 1, N 'searchstring', NULL, NULL, NULL, N'asc'
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search