BOL documentation says sysadmin permission is required to run debugger.
I'm 90% certain there is no workaround to this requirement, but thought I would ask just in case someone found a way to grant Debugger permission without granting sysadmin permission.
What do people do when you have a team of developers needing to step through a complicated cursor loop with variables, etc to debug some aspect of that?
Most shops don't allow developers to have sysadmin permission even on development servers, and many wouldn't allow devs to keep a copy of enterprise data on their local machine with their own developer sql server edition e.g. due to PII and data security reasons.
Not sure why the debugger would be set up this way.
So, I'm curious how other people handle the requests for Debugger permission in a similar scenario.
What do you do in your environment?
Best Answer
You could add a
declare @idebug int
variable to your stored procedures and then code around the important bits when you require relevant information.Your stored procedure would then look a bit like this:
This is just an example of how it can be done.
You would then call the sproc with:
...which would the provide basic (bitwise
1
) and detailed (bitwise2
) information, depending on where you inserted the relevant code.I had issues once while running a stored procedure that wasn't producing the right results and I had to debug the individual statements, so I just entered the various debugging levels in the stored procedure and when required ran the sproc with the relevant
@iiDebug
values depending on the level of information I required.Examples of input values:
Examples as code (input variable
@iiDebug
is stored in@debug
in the sproc code):These are just quick examples of how you can introduce debugging without having access to the SQL Server Debugger or the required privileges.