Archive

Archive for June, 2007

SQL debugging and Visual Studio

June 12th, 2007 Comments off

Most development nowadays involves an application and a SQL database. Under Microsoft SQL 2000, single stepping / debugging stored procedures and functions in Enterprise Manager was real easy.

With SQL 2005, Microsoft moved that functionality away from new Management Studio and pushed it into the Visual Studio 2005 environment – sweet. All you now need to do is start a “Database Project“.

Well, there’s a gotcha.

When debugging a C++ or .NET project with SQL debugging enabled, the SQL profiler reveals the numerous calls to a “sp_sdidebug” stored procedure.

Somehow these calls combined with the location of normal application breakpoints causes the some ATL - SQL interface to fail / misbehave.

The misbehavior is the SQL stored procedure call dropping from the application code down into the ATL code and freezing – stuck in a loop. No timeout whatsoever!

THE FIX: Loose or disable all application code breakpoints on or near the ATL based SQL interface calls.

The “sp_sdidebug” stored procedure is pretty much undocumented. The only thing that I do know is that it provides or has a debug COM interface for the SQL engine.

So the theory is that the ATL COM and “sp_sdidebug” COM have issues. It could even be the Visual Studio interface – who knows?

Drop a comment here if you can provide an explanation or some further insight into this behavior.

Checkout: KB817178, KB328151

Categories: Software Tags: