T-SQL debugging in VisualStudio – DB access issue

Issue

This Content is from Stack Overflow. Question asked by karek

We’ve been trying to set-up SQLdebugger for our sql server database instance on test environment. Our aim was to allow developers to debug sql procedures execution through VisualStudio. One of the requirements is to grant sysadmin role for the user. We created a dedicated sql user for this purpose and we pass its credetials when starting debugger but unfortunately it does not work. It appears that sql user is ignored by the debugger and it is windows user that is passed to DB that is missing sysadmin on the SQLServer (the same that runs VisualStudio).

In details here is what we do:

  1. First we run VisualStudio (2019, 2022 – it makes no difference) as a current windows user and prepare some script that runs a stored procedure on SqlServer. We run it using ‘Execute with debugger’ option

enter image description here

  1. SQl connecion dialog appears where w enter SqlServer user with sysadmin role on the SQL Server.

enter image description here

  1. After clicking ‘Connect’ following error appears:

enter image description here

We already checked that granting sysadmin role for the windows user that runs VisualStudio resolves the issue but this is not the way to go.

Do You have any idea if it is some bug in the debugger or the behaviour is as it should be? I do not get the purpose of displaying sql connection dialog if it is ignored eventually.

Thanks.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?