Page 1 of 1

Debug: step into stored procedure with sp_executesql

Posted: Mon 10 Jun 2019 20:35
by bruceradtke
Hello,
I'm doing an eval and have a question.

I have a length stored procedure which builds a string to execute.
When I debug with dbForge, it does not let me step into the sproc (with F11).
When I debug the same code with SSMS, I can step into the dynamic SQL ok.

Here is my statement from the proc:
EXEC sp_executesql @sql
,N'@ValidationErrorsID uniqueidentifier, @ActionID uniqueidentifier, @PrimaryKeys varchar(MAX), @UserID uniqueidentifier, @SessionID uniqueidentifier, @SessionSessionID uniqueidentifier, @PreviousWorkflowStepID uniqueidentifier'
,@ValidationErrorsID
,@ActionID
,@PrimaryKeys
,@UserID
,@SessionID
,@SessionSessionID
,@PreviousWorkflowStepID;
To recap, SSMS handles this and lets me step into this. However, dbForge does not
let me step in but steps over.

I am a newbie here - is there something I am missing?

Thanks.

Bruce

Re: Debug: step into stored procedure with sp_executesql

Posted: Fri 14 Jun 2019 12:53
by alexa
In case you are attempting to debug a stored routine that is invoked from a SQL script, the Code Debugger doesn't debug the stored procedure's definition row by row but in whole.

If you want to debug the stored procedure, you have to right-click it in Database Explorer and select 'Debug -> Step Into (F11)' from the popup menu.

Re: Debug: step into stored procedure with sp_executesql

Posted: Wed 19 Jun 2019 13:29
by bruceradtke
Hello,
Thanks for the reply. I don't think I explained the situation clearly.
Our application uses a lot of dynamic sql.
The following 4 lines are snipped from a stored procedure.
I left out some variable definitions for brevity.

declare @sql varchar(max)
declare @ActionCallOutProc varchar(max) = 'dbo.actionsCallout'
set @sql = @ActionCalloutProc + ' @DataKeys = @DataKeys, @UserID = @UserID,';
EXEC sp_executesql @sql, N'@DataKeys varchar(MAX), @UserID uniqueidentifier,;

At Line 4 in SSMS, I can use StepInto (F11) debugger to debug the 'dbo.actionsCallout' stored procedure.
In dbForge, I debug to line 4 and select 'StepInto' or press F11, and dbForge just steps over 'dbo.actionsCallout'. dbForge does not step into dbo.actionsCallout.

I like a lot of dbForge but this issue is a tipping point for me. The application I am working has extensive use of dynamic SQL with above code.

Am I correct that dbForge will NOT step into dynamic SQL like above?

Thanks,
bruce

Re: Debug: step into stored procedure with sp_executesql

Posted: Thu 20 Jun 2019 09:42
by alexa
You are correct.

Though, we are going to support this in one of the next product versions.