Error 18031

Severity

0

Message text

This procedure can only affect thresholds in the current database. Say 'USE %1!', then run this procedure again.

Explanation

Thresholds for a specified database can only be created or modified while in the database. Error 18031 occurs when you try to run sp_addthreshold, sp_dropthreshold, or sp_modifythreshold when you are not in the database for which you are running the command.

Action

  1. Determine the name of the current database:

    1> select db_name()
    2> go
    
  2. Select the correct database:

    1> use <database_name>
    2> go
    

    Where <database_name> is the name of the database for which you want to run the threshold command.

  3. Rerun the sp_addthreshold, sp_dropthreshold, or sp_modifythreshold command.

Versions in which this error is raised

All versions