views:

62

answers:

4

I have Visual Studio .Net project which uses ADO connection to call stored procedure of SQL Server database.

It is possible to set a breakpoing at stored procedure and debug it. I have local SQL Server and SQL Enterprise Edition installed.

+1  A: 

AFAIK, and if you are talking about an actual t-sql stored procedure, Your best bet will be:

  1. figure out what parameters you are passing into the stored procedure when (if?) it causes problems
  2. Extract the actual SQL code from the body of the stored procedure and copy that into a new query analyzer window,
  3. Run that script with the values from #1.
peacedog
the problem is that one SP is called when it shouldn't be.I need to 'catch' who's calling it
Captain Comic
Ahhh, well yes you can put a breakpoint in your code and do it that way. Do you have an idea of *where* in the code the call *might* be coming from? If not, you may need to do a lot of F10 work, but you'll find it eventually. It may help to keep SQL Server Profiler open and running as you go.
peacedog
Sure I know this way. But my question was if there is debug mode in SQL server where I can put breakpoint using SSMS and wait until some application triggers it
Captain Comic
+1  A: 

There are a couple options i have heard of for debugging stored procs- eg: Direct Database Debugging.

here is a link from a good article i found explaining some of these: Stored Proc Debugging Methods

Diakonia7
+1  A: 

You can debug CLR procedures and functions from VS, see Debugging SQL

Transact-SQL is a different story, it needs special configuration steps and can be debugged from a special tool, see Using the Transact-SQL Debugger.

Remus Rusanu
+1  A: 

Use the SQL Server Profiler (under Tools menu in SQL Server Management Studio) to see the exact calls being sent from ADO to your database procedures. Then you can figure out where the problem is and start debugging, whether in SSMS or Visual Studio.

Alison R.