sql - RAISEERROR Date and Time -
I have been running SQL statement for a long time ... catches
BEGIN Cache Declar @ErrorMsg = ERROR_MESSAGE (), @ ErrSevirity = Error_Sevirity () RAISEERROR (@ErrorMsg, @ErrSevirity, 1) --do Rollback End Catch I know that the stored procedure failed, how do I get the error message? Sysmessages do not have a time-zone area, can I in some way include it in another table so that there is a date and time of error?
Choose from master.dbo.sysmessages > Using the RAISERROR () function inside your catch block does not mean too much, it's something you use in You can. Hold Block to enter TRAK BLock . Once you (your control) is in the Cache Block, you have all the error functions to get detailed information about your error. Just select them work
Rearrar function is used in the block. And once you have made an error in the attempt block, ERROR_MESSAGE () will be populated with your custom error message.
See below:
Try - prior verification IF (some rules) RAISARR ('Your Customer Error Message', 16,1) ED Transaction / * Your Code Catch here * / COMMENT TRANSITION IF (@@ TRANCOUNT & gt; 0) Initial transaction; End - Select your error logging error message as ERROR_MESSAGE (), Error Variation as ERROR_LINE (), Error Variation as ERROR_SEVERITY (), GETDATE () AS Error_DateTime END Catch
Comments
Post a Comment