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".
- as general rule, errors severity level of 16 or higher logged automatically sql server log , windows application log.
- errors severity level 19 through 25 can specified members of sysadmin fixed server role.
- errors severity level 20 through 25 considered fatal , cause connection terminated , open transactions rolled back.
- 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
for window application log
control panel ➪ system , security ➪ administrative tools ➪ event viewer.
Comments
Post a Comment