Some SQL error conditions return information that can appear somewhat generic, and as a result, makes diagnosing particular issues difficult. To enhance diagnostic capabilities, when a SQL error now occurs, a new error logging option is available.
SQL_DEBUG ERROR_INFO
When this keyword is enabled in the server configuration, and a SQL specific error occurs, an event is logged in the sql_server.log file in the server's working directory. Information included in this event include any error that may occur running a query, the query statement, the execution plan, and the SQL RPC function number that returns the error. This will provide a valuable source of information in the case of internal handling errors of SQL, such as the MM susbsystem for the storing and sorting of temporary tables.