I am trying to debug Microsoft SQL Server stored procedure from Visual Studio 2022. When I step into the code, I see what is shown in the screenshot. The actual stored procedure is not getting opened.
Is there any solution for this? SQL Server is on the same PC as my Visual Studio.
2
Answers
Your question-post didn’t say if you’re using the Start Debugging command from within an SSDT (
.sqlproj
) project – or if you used the Attach to Process command to attach-to and debugsqlservr.exe
.…but I assume the latter…
…in which case, before you attach to
sqlservr.exe
you need to ensure you’ve selected only T-SQL Debugging, like so:I am having the same problem.
We recently upgraded to VS 2022 Pro from VS 2019 Pro. I have both versions installed.
To do some testing of this issue, I made a copy of my VS 2022 workspace (ws-2022) using Windows Explorer. The new copy is called ws-2019.
I did not change anything in the new workspace. The contents of two workspaces are identical.
I want to debug the SP named MySP that is called from following SQL script:
It worked fine in VS2019. The SQL code appeared and I was able to debug.
I do the same process using VS2022 in the ws-2022 workspace and it fails.
I get the same error as OP when I press [F11] at the EXEC.