views:

51

answers:

1

Hello everyone,

I am using SQL Server 2008 Enterprise. When we met with such error message from stored procedure,

Message 1205, Level 13, State 52, the process Pr_FooV2, Line 9 Services (Process ID 111) and another process is deadlock in the lock | communication buffer resources, and has been chosen as the deadlock victim. Rerun the transaction.

I am wondering whether such messages are stored in log files? I searched log folder of my SQL Server 2008 installation root (in my environment, it is C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log), but can not find such files.

thanks in advance,

George

+2  A: 

In SQL 2008 it looks like you can via sp_altermessage.

http://sqlblog.com/blogs/tibor_karaszi/archive/2009/05/14/sp-altermessage-is-back-in-business.aspx

Edit: Example to perform batch operation for all messages of severity 14

DECLARE @severity INT
SET @severity = 14

declare @dynsql nvarchar(max)

set @dynsql = ''

SELECT   
    @dynsql = @dynsql + 'EXEC sp_altermessage
     @message_id = ' + CAST(message_id AS varchar(10)) + '
    ,@parameter = ''WITH_LOG''
    ,@parameter_value = ''true'' ;
'
FROM
(
SELECT DISTINCT message_id 
FROM         sys.messages
WHERE  is_event_logged=0 AND severity=@severity
) D

EXEC sp_executesql @dynsql
Martin Smith
Cool! But how to turn-on to log all messages (all error messages with different message IDs, and the Url you recommended mentioned only how to turn on logging for a specific message ID)?
George2
I'll update my post to handle this but you're just going to end up with a load of messages in the event log with absolutely no context to them though if you do that.
Martin Smith
"I'll update my post to handle this" -- thank you and looking forward to your solution! :-)I am running long-run testing against my database and I need such information.
George2
Why do you meantion eventlog here? Error message will go to event log and not sql server log folder?
George2
@George2 Everything that appears in the SQL Error log also shows up in the Windows Event log as far as I know. If all that you want is a bunch of Error messages without any contextual data whilst you test your application you'll probably be better off setting up a SQL Server trace to get these.
Martin Smith
Cool, question answered! Here is another question about SQL Server log, any ideas? :-)http://serverfault.com/questions/148469/sql-server-2008-log-issue
George2

related questions