cheong wrote:
Do you really need to do that in T-SQL?


Yes, it really has to be SQL.

cheong wrote:
I thought the errors can be retrieved in SqlException (if using .NET ) or Error collection of ADO Connection object. Both of them have those %d or so filled for you already.


You're right, ADO gets the *friendly* error messages from the DBCC OUTPUTBUFFER.

What I'm looking for is a way to parse the DBCC OUTPUTBUFFER (It's Hex and has a lot of stuff other than the message) using TSQL.

Call me crazy...