Solved

Debugging a SQL Server Script using Visual Studio?

Posted on 2015-02-24
6
114 Views
Last Modified: 2015-02-25
Is it possible to debug a SQL Server script while running a VB.Net application in debug mode? If so, how is this done because I really need to debug a SQL script and just not sure what the best way is to do it!

Thanks!
0
Comment
Question by:BlakeMcKenna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 40629811
Hi BlakeMcKenna;

See this Microsoft Documentation.

Debugging Transact-SQL Database Objects
0
 

Author Comment

by:BlakeMcKenna
ID: 40630590
Fernando,

This is what I've been looking for, however, I'm a little confused as to whether it can be debugged while the application is running. What I'm trying to accomplish is that when my app is running and at the point of executing the Stored Procedure, which is what I want to debug, I want the GUI to go into debug mode at that point right into the SP. That's where I'm at right now. Also, I'm using VS 2013 Professional edition and the above link uses verbage that I don't see.  For example, it says to right-click on the object within the Database, in my case the SP and select "Step Into" <object>. That isn't part of any popup menu that I see.

Thanks!
0
 

Author Comment

by:BlakeMcKenna
ID: 40630661
Fernando,

When I tried to execute the SP for debug, I got an error message. See attached image. It had to do with permissions, however, when I went to look in the "System Stored Procedures" Folder, the SP listed was not present.
Screenshot.jpg
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 40631659
Hi BlakeMcKenna;

I had a hard time finding out how to enable SQL Stored Procedure in Visual Studio 2013 seeming it changed since I used it in earllyer version.

1. In Solution Explorer right click on the Project Name, NOT Solution name, and select Properties from context window.
2. In the Properties window select the Debug tab at the left of the window.
3. At the bottom of the window make sure the Enable SQL Server Debugging has a check mark on it.
4. From the Main Menu in Visual Studio click on View -> SQL Server Object Explorer.
5. If your SQL Server instance is not in the list of SQL Servers right click on the top node SQL Server and select Add SQL Server ... and use the SQL Server Login window to login to the missing server.
6. Select the server from the list and right click on it.
7. Click on Application Debugging.

At this point you will be able to set break points in the SQL Script and it will stop on the break point.
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 40631742
Thank you Fernando...that is exactly what I have been looking for!
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 40631770
Not a problem BlakeMcKenna; glad I was able to help.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question