SQL Debugging
-
How? This is my first real venture into SQL (other than SELECT * from XYZ) and I am having trouble with a stored procedure - all the data in looks okay but... it doesn't return the right answer. Is there a way to debug a SP so that when called I can see what is going on.
Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku
-
How? This is my first real venture into SQL (other than SELECT * from XYZ) and I am having trouble with a stored procedure - all the data in looks okay but... it doesn't return the right answer. Is there a way to debug a SP so that when called I can see what is going on.
Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku
The method I use to debug a procedure is to put print statements throughout the procedure so you can see what the values you are getting really are. It's a clunky method but usually works well. Most procedures are not that complicated. You have to do this in Query Analyzer. If you have specific statements you are having problems with paste them here.
-
How? This is my first real venture into SQL (other than SELECT * from XYZ) and I am having trouble with a stored procedure - all the data in looks okay but... it doesn't return the right answer. Is there a way to debug a SP so that when called I can see what is going on.
Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku
-
Starting the Debugger[^] Andy Gaskell, MCSD MCDBA
thanks - that'll help debug the obvious I was hoping I could wait until it was called and see what values were being passed in and the step through. Could I use the profiler for this at all?
Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku
-
thanks - that'll help debug the obvious I was hoping I could wait until it was called and see what values were being passed in and the step through. Could I use the profiler for this at all?
Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku
Profiler wouldn't really be much help for debugging. It is mainly good for finding performance bottlenecks & problems. I have had good success on debugging in Query Analyzer using the method described above. You can run the procedure straight out of QA and put exit points at various points if necessary - using the RETURN statement. Once you get used to it you can debug relatively quickly.