locked
Logging Error Message RRS feed

  • Question

  • I have a table with the colums:


    FirstName LastName TemporaryID     PermanentID
    Harry       Potter 12345  NULLL
    RAM         R  5678  NULL

    The above column is being updated with the help of the stored procedure .

    I am writing a stored procedure and within this stored procedure i'm calling other stored proc to update PermanentID column in the above table.

     

    i'm using while loop for this/

    Within while loop i'm calling the other stored procedure and updating this column for each record .
    But , just in case during the process if there is any problem , I dont want to come out the loop instead I want to log the error message into a table and continue looking for the next record.
    But,since I am using the stored procedure wiht try and catch block it automatically goes to catch and the process stops .

    How can log the errror message within the TRY BLOCK .

    Friday, February 1, 2013 5:17 PM

Answers

  • Try this link -

    http://www.sqlservercentral.com/Forums/Topic1403316-1292-1.aspx


    Narsimha

    • Marked as answer by anki2010 Friday, February 1, 2013 7:55 PM
    Friday, February 1, 2013 6:34 PM

All replies

  • try to create RaiseError in your inner procedure which is updating your permanentID in the loop.

    in the RaiseError you need to give low severity level.

    http://msdn.microsoft.com/en-us/library/ms178592.aspx


    Thanks & Regards Prasad DVR

    Friday, February 1, 2013 5:25 PM
  • this way , I wont be able to log the error message created by the SQL Server .Right ?

    it will log the error message that is being hardcoded .

    Friday, February 1, 2013 6:15 PM
  • Try this link -

    http://www.sqlservercentral.com/Forums/Topic1403316-1292-1.aspx


    Narsimha

    • Marked as answer by anki2010 Friday, February 1, 2013 7:55 PM
    Friday, February 1, 2013 6:34 PM
  • thanks Naarasimha .,
    Friday, February 1, 2013 7:55 PM