Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug or step through the code in SQL Server Management Studio 18?

SQL Server Management Studio used to have Debug functionality that would allow to step through the code and watch the values etc. Referring to How to add the Debug button to SSMS v18?, I understand that the functionality is removed from SQL Server Management Studio V18.1.

But what is the alternative now? How do you step through the code to pinpoint a bug in the code?

like image 365
HappyTown Avatar asked Jun 12 '19 15:06

HappyTown


People also ask

How do you debug in SSMS 18?

To debugging SP, go to database->Programmability->Stored Procedures-> right click the procedure you want to debug->select Debug Procedure.

How do I debug SQL Server studio?

You can start the debugger by either clicking the Debug button on the Query toolbar or by clicking Start Debugging on the Debug menu. The Query Editor window stays in debug mode until either the last statement in the Query Editor window finishes or you stop debug mode.

How do I step through a SQL Server code?

Click the Step Out button on the Debug toolbar. Press SHIFT+F11. Right-click in the Query Editor window, and then click Run To Cursor. Press CTRL+F10.


2 Answers

You can use Visual Studio (the full IDE) to do it:

  1. Use "Server Explorer" (Under the View menu) to connect to your DB
  2. Right-click the DB and choose "New Query" (or find a stored procedure to debug)
  3. Set a break point (F9 key or otherwise) on a line of SQL
  4. Right-click inside the SQL editor and choose "Execute with Debugger"
like image 188
jeoffman Avatar answered Oct 28 '22 04:10

jeoffman


Your best option is to not upgrade version 18.X, but stay on 17.9 until the Microsoft Product Manager gets sacked. A similar thing happened in going from SQL Server 2000 to SQL Server 2k5. Eventually, they capitulated and re-introduced the feature.

like image 36
Lysoll Avatar answered Oct 28 '22 04:10

Lysoll