Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL Debugging

SQL Debugging

Scheduled Pinned Locked Moved Database
databasequestionsharepointcomdebugging
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shaun Wilde
    wrote on last edited by
    #1

    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

    N A 2 Replies Last reply
    0
    • S Shaun Wilde

      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

      N Offline
      N Offline
      notadood
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • S Shaun Wilde

        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

        A Offline
        A Offline
        AndyG
        wrote on last edited by
        #3

        Starting the Debugger[^] Andy Gaskell, MCSD MCDBA

        S 1 Reply Last reply
        0
        • A AndyG

          Starting the Debugger[^] Andy Gaskell, MCSD MCDBA

          S Offline
          S Offline
          Shaun Wilde
          wrote on last edited by
          #4

          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

          N 1 Reply Last reply
          0
          • S Shaun Wilde

            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

            N Offline
            N Offline
            notadood
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups