sql - How does Error_Message() work? -


how error_message() function works , raised error data stored?

i have write code read errors raised not handled yet (catch block not reached end, in our db takes minutes catch block finish). question is:

where can data related raised errors?

improve (update): suppose have code this:

begin try   declare @a int = 1 / 0 end try begin catch   print error_message()    -- can write instead of error_message() same result? end catch 

it depend on error severity level in error

msg 547, level 16, state 0, line 11

the insert statement conflicted foreign key constraint "fk_products_ categories".

  1. as general rule, errors severity level of 16 or higher logged automatically sql server log , windows application log.
  2. errors severity level 19 through 25 can specified members of sysadmin fixed server role.
  3. errors severity level 20 through 25 considered fatal , cause connection terminated , open transactions rolled back.
  4. errors severity level 0 through 10 informational only.

asp er first point can error @ sql sever log , window application log

for sql server log

object explorer in management ➪ sql server logs node lists logs. double-clicking log opens sql server’s cool log file viewer

enter image description here

for window application log

control panel ➪ system , security ➪ administrative tools ➪ event viewer.

enter image description here


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -