only system administrator can specify with log option for raiserror command SQL

Bala Narasimha Challa 466 Reputation points

Hi Team,

am trying to use raiserror command but am getting bellow error message
only system administrator can specify with log option for raiserror command.

did I miss any permissions ?

A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,455 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 92,881 Reputation points

    Yes, to use the WITH LOG option you need to be member of the sysadmin role, or hold the server level permission ALTER TRACE.

    You need to use WITH LOG, if you specify a severity level >= 19. There is rarely need for this.

    0 comments No comments

  2. NikoXu-msft 1,911 Reputation points

    Hi @Bala Narasimha Challa ,

    If you look in MSDN RAISERROR (Transact-SQL) you can read the following in the arguments section for severity

    Severity levels from 0 through 18 can be specified by any user. Severity levels from 19 through 25 can only be specified by members of the sysadmin fixed server role or users with ALTER TRACE permissions. For severity levels from 19 through 25, the WITH LOG option is required. Severity levels less than 0 are interpreted as 0. Severity levels greater than 25 are interpreted as 25.

    Best regards


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments