Dette hjælper dig ikke i øjeblikket, men kan være interessant for folk på SQL Server 2008. På SQL Server 2008 kan XEvents bruges til at logge alle fejldetaljer (inklusive sætningstekst) til en central placering.
IF EXISTS(SELECT * FROM sys.server_event_sessions WHERE name='ErrorLogger')
DROP EVENT SESSION [ErrorLogger] ON SERVER;
CREATE EVENT SESSION [ErrorLogger]
ON SERVER
ADD EVENT sqlserver.error_reported(
ACTION (sqlserver.sql_text)
WHERE (([severity]>(10))))
ADD TARGET package0.asynchronous_file_target(
SET filename='c:\temp\error_logger.xel', metadatafile='c:\temp\error_logger.xem')
WITH (MAX_MEMORY = 4096KB, EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS,
MAX_DISPATCH_LATENCY = 30 SECONDS, MAX_EVENT_SIZE = 0KB,
MEMORY_PARTITION_MODE = NONE, TRACK_CAUSALITY = OFF, STARTUP_STATE = ON)
ALTER EVENT SESSION [ErrorLogger] ON SERVER STATE = START
Og for at gennemgå fejlene
SELECT CONVERT (XML, event_data) AS data
FROM sys.fn_xe_file_target_read_file ('C:\Temp\error_logger*.xel', 'C:\Temp\error_logger*.xem', NULL, NULL)