How to find what caused errors reported in a SQL Server profiler trace?

落花浮王杯 提交于 2019-12-05 05:56:36

Don't worry about the 208 errors. 208 is "Object not found". Profiler picks up these due to what's called 'deferred name resolution'.

Take the following procedure.

CREATE PROCEDURE Demo AS
  CREATE TABLE #Temp (ID int)
  INSERT INTO #Temp VALUES (1)
  SELECT ID FROM #Temp
GO

That proc will run fine without any errors however, if you have a profiler trace running, you'll see one or two instances of error 208. It's because the table #Temp doesn't exist when the proc starts, which is when the code is parsed and bound. The process of binding to the underlying objects fails.

Once the create table runs, the other statements get recompiled and bound to the correct table and run without error.

The only place you'll see that deferred resolution error is in profiler.

in sql 2005 you can't. you'll have to run the profiler trace of SQL:StmtStarting, SQL:StmtCompleted, User Error Message and Exception events with text, transactionId, EventSequence and otehr columns you need to get a picture of what's going on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!