Is there something like a \"debug attach\" for the SQL debugger? I have a middleware tool (BizTalk) that is calling a stored procedure and would like to debug it.
As al
sp_TraceGenerateEvent is useful to write data to the profiler. (Example usage here: https://blogs.technet.microsoft.com/fort_sql/2012/06/21/capture-custom-events-in-profiler-for-troubleshooting/)
Just beware that when BizTalk calls the stored proc, it has two passes, once with FmtOnly=On, and the second (the real execution) with FmtOnly=Off. You might not reach the second pass if you have certain errors on the first pass. Getting sp_tracegenerateevent to work in a stored procedure
When FmtOnly=On, the Trace Profile can be confusing, leading you to believe it's running when it's really just checking for what data/columns will be returned. Can SQL Begin Try/Catch be lying to me (in the profiler)?