Solved

Debugging a SQL Server Script using Visual Studio?

Posted on 2015-02-24
6
112 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

729 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