Getting sp_tracegenerateevent to work in a stored procedure

后端 未结 2 913
时光取名叫无心
时光取名叫无心 2021-01-21 22:15

I\'m having a hard-time debugging a stored procedure called from BizTalk.

In a prior thread, someone suggested using sp_trace_generateevent. [Use SQL Debugger when sto

2条回答
  •  醉酒成梦
    2021-01-21 22:25

    It turns out that BizTalk calls the Stored Proc twice, once with FmtOnly=On and once again with FmtOnly=Off. I was getting the invalid cast exception after the first call, so the Stored Proc was essentially not really executing. I was mislead by the profiler because of the FmtOnly=On, thinking that it was actually executing the statements I saw there. Thus the sp_TraceGenerateEvent doesn't actually run on the first pass with FmtOnly=On, but later when I got past the other errors, it works fine in the second pass with FmtOnly=Off.

    Reference: Similar questoin I posted about why the SQL Profiler was looking different between an SSMS run and a BizTalk run of same stored proc: Can SQL Begin Try/Catch be lying to me (in the profiler)?

提交回复
热议问题