Solved

Debugging a SQL Server Script using Visual Studio?

Posted on 2015-02-24
6
100 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
  • 3
  • 3
6 Comments
 
LVL 62

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 62

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 62

Expert Comment

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now