|
-
Jul 3rd, 2008, 10:43 AM
#1
[RESOLVED] Debugging w/ SQL server
Is there a way to step through a stored procedure, in a similar way to how you do with .NET source? Small procs aren't bad, but sometimes troubleshooting/debugging is a nightmare on larger procs.
-
Jul 3rd, 2008, 11:38 AM
#2
Re: Debugging w/ SQL server
Nope... not really .... we usually end up using SQL Profiler and watch the DB as the SP executes.... we can then see the calls, and the entire execution of the sproc.
-tg
-
Jul 3rd, 2008, 12:01 PM
#3
Re: Debugging w/ SQL server
I do the same as TG. Use the TSQL_SPs template for the best results. The only frustrating thing is you don't get to interrogate the values that are being assigned to variables during processing but you do get to see the parameter values that get passed into any sproc/function calls and you can at least follow the path it takes through the sproc.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Jul 4th, 2008, 05:28 AM
#4
Re: Debugging w/ SQL server
Erm, yes there is guys.
I am assuming here that you are on about 2005/2008 SQL Server. 2000 has this also, but it's performed within the Query Editor application.
In Visual Studio you can bring up the Data Connections I think it is window. You can add/find your SQL server instance there and expand and navigate the neccessary containers until you find your stored proc. When you right click a stored proc, you get an additional popup menu option of debug, or Edit which will provide this functionality. You get a debugger session in which you can specify test values, have full breakpoint and execution navigation (step into etc.) support (Edit: after re-read of the above - and the locals window to keep tabs on variable assignments) similar to the way you have when debugging .Net code.
If you haven't got a full copy of .Net available, I believe you can use the BIDS (business intelligence development environment) which ships with SQL server and still have this. Debugging, Integration Services and Reporting Services support/interaction was why this tool was shipped with SQL Server 2005/2008.
I'm sorry some of the names of the environments and/or menus & windows may be different to those mentioned above, but I haven't got a local install here and this is from memory. Please post if any of the above names require altering and I'll edit the post for others to see.
-
Jul 4th, 2008, 05:33 AM
#5
Re: Debugging w/ SQL server
SQL Profiler is a fantastic tool also, however I tend to find myself using this just really for when evaluating any fully produced SQL Statements which have been construced and completed (having the parameters inserted and user entered values all inserted etc.) from .Net and are being passed to SQL Server. It's a Godsend to be able to see the whole statement produced as it's fired to SQL Server to check this for anomolies - great little tool that is!
-
Jul 6th, 2008, 12:48 PM
#6
Re: Debugging w/ SQL server
You are the bomb, can't wait to try this out tomorrow.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|