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. sp_depends return value

sp_depends return value

Scheduled Pinned Locked Moved Database
sharepointhelpquestion
3 Posts 2 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.
  • P Offline
    P Offline
    preinsko
    wrote on last edited by
    #1

    Hi all, I have an admin sproc that I've used for a long time; but apparently I never noticed that sp_depends doesn't return a failure value. I suppose over time I have just never checked a sproc that had no dependencies which is how I discovered this. sp_depends raises an error if there are no dependencies unfortunately the return Value is 0 for all cases. Therefore using checking the return value is of no use. Since I use a return Value and a retCode in my sproc I was wondering if there is some system variable I can use to get the last error raised when exec a sproc from a sproc?? Currently I am checking for the table count and if it is 0 then I display the same message sp_depends would. I would rather the error number be returned in my return code so I can look up the mesage or have a custom message of my own. Thanks Pamela Reinskou VersusLaw Inc.

    M 1 Reply Last reply
    0
    • P preinsko

      Hi all, I have an admin sproc that I've used for a long time; but apparently I never noticed that sp_depends doesn't return a failure value. I suppose over time I have just never checked a sproc that had no dependencies which is how I discovered this. sp_depends raises an error if there are no dependencies unfortunately the return Value is 0 for all cases. Therefore using checking the return value is of no use. Since I use a return Value and a retCode in my sproc I was wondering if there is some system variable I can use to get the last error raised when exec a sproc from a sproc?? Currently I am checking for the table count and if it is 0 then I display the same message sp_depends would. I would rather the error number be returned in my return code so I can look up the mesage or have a custom message of my own. Thanks Pamela Reinskou VersusLaw Inc.

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      The @@ERROR variable holds the last error number.

      P 1 Reply Last reply
      0
      • M Mike Dimmick

        The @@ERROR variable holds the last error number.

        P Offline
        P Offline
        preinsko
        wrote on last edited by
        #3

        Yes, this is true; but in this case it is overwritten as soon as the next statement in the sp_depends sproc is executed. Therefore by the time my sproc receives the output the @@Error is 0 again. I was thinking maybe there was some undocumented system function(s) that handles scope much like the identity functions, Scope_Identity and @@Ident_current. You can check this for yourself by comparing the results of sp_depends on an object that has dependencies and one that doesn't, set a local var to return the returnValue and also try to grab the @@Error and you will see in all cases the returnValue is 0 and @@Error is 0. For now I am trapping it and using table count that seems to be the only way to figure it out. Thanks. Pamela Reinskou VersusLaw Inc.

        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