Hi Geoff,
Thanks for the articles, they've been a great use and were easy to follow.
I've followed through the tutorial and the EventLogStaging table is written to when using the RAISERROR example that you mentioned.
However, I want to use this for all SQL Server errors, and I've noticed that other Errors which end up in the Event Viewer Application log are not being picked up by the VB script. I'm not sure why, as to my knowledge the 'where' in the VB script should not exclude them.
Here is an example of an error which exists in the Event Viewer Application log but hasn't been picked up by the script:
Log Name: Application
Source: SQLISPackage100
EventID: 12291
Level: Error
User: DOMAIN\SQLServiceAccount
OpCode:
Task Category: None
Keywords: Classic
Computer: SQLSERVER.DOMAIN.LOCAL
Message: Package "Package1" failed.
And here is the test one which you used in the article, which is being picked up by the script:
Log Name: Application
Source: MSSQLSERVER
EventID: 17063
Level: Error
User: DOMAIN\myuseraccount
OpCode:
Task Category: Server
Keywords: Classic
Computer: SQLSERVER.DOMAIN.LOCAL
Message: Error: 50000 Severity: 16 State: 1 working great
This is the select which I am using (I've removed the 'like 'MSSQL%'' from the where):
query = "Select * from __InstanceCreationEvent" _
& " " & "where TargetInstance isa 'Win32_NTLogEvent' and" _
& " " & "(TargetInstance.Logfile = 'Application' or TargetInstance.Logfile = 'System')" _
& " " & "and (TargetInstance.EventType = 1 or TargetInstance.EventType = 2)"
Any ideas why other types of errors (which aren't raised using RAISERROR) aren't being picked up by the script?
Any help would be appreciated.
Thanks
Phil