Multiple choice sql-server

Under what occasions does the SQL Server 7 write events to the Windows NT application log?

  1. When the xp_logevent stored procedure is invoked

  2. When sp_addmessage or sp_altermessage define errors to be written to the NT application log

  3. When SQL Server errors occur with severity levels between 19 and 25

  4. When the RAISEERROR WITH LOG statement is executed

  5. All of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

SQL Server writes to the Windows NT application log through multiple mechanisms. The xp_logevent extended stored procedure explicitly logs custom messages. System stored procedures sp_addmessage and sp_altermessage can configure error messages to write to the NT log. SQL Server automatically logs errors with severity levels 19-25 (critical errors). The RAISERROR WITH LOG statement also forces logging. Since all four methods are valid, option E is correct.

AI explanation

SQL Server 7 writes to the Windows NT application log in several distinct situations: when xp_logevent is explicitly called, when sp_addmessage/sp_altermessage have configured a message to be logged, when an error's severity falls in the 19–25 range (these are treated as serious/fatal), and when RAISERROR ... WITH LOG is executed. Since all of these independently trigger a log write, "all of the above" is the accurate summary answer.