Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Posts
    9

    Unanswered: how can i know execution stutus of a stored procedure

    hi


    i want to know the execution status of a stored procedure . That is i want to know whether the stored procedure was executed succesfully or not.If not i want to get the error message

  2. #2
    Join Date
    May 2007
    Posts
    49
    It depends on the tasks procedure is going to perform. One way is to use error handling mechanism provided by SQL server.
    Mihir Mehendale
    DB Team @ Clarion
    Clarion Technologies
    (SEI CMMI Level 3)
    Pune, India
    www.clariontechnologies.co.in
    www.vEmployee.com

  3. #3
    Join Date
    May 2007
    Location
    somewhere in dbforums
    Posts
    221
    you can check the value of @@ERROR at the end of your stored procedure and return it......if there is any error in the stored proc it will be indicated in the value of @@ERROR

  4. #4
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    Quote Originally Posted by nick.ncs
    you can check the value of @@ERROR at the end of your stored procedure and return it......if there is any error in the stored proc it will be indicated in the value of @@ERROR
    This is not quite true. If the sproc has multiple steps (for example a select, an insert, another select, and a delete) you will need to check the value of @@ERROR after each DML statement, because @@ERROR only contains the return value from the last operation.

    I encourage developers to save the value of @@ERROR into a variable, and then inspect the value of that variable as needed.

    -- This is all just a Figment of my Imagination --

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •