nscontrol delete Command

Deletes an existing instance of SQL Server Notification Services.

Syntax

nscontrol delete 
    [-nologo]
    [-help]
        –name instanceName
        -server databaseServer
    [-sqlusername sqlUserName -sqlpassword sqlPassword]
    [-force]

Arguments

  • nologo
    Suppresses the product and version statement that appears when you run an nscontrol command.
  • help
    Displays the command syntax.
  • nameinstanceName
    Is the name of the instance to delete.
  • serverdatabaseServer
    Is the name of the server that hosts the instance and application databases. If you use a named instance of SQL Server, you must specify both the server name and the instance name using the format servername\instancename.
  • sqlusernamesqlUserName
    Is the SQL Server logon ID used to connect to SQL Server.

    If you are using SQL Server Authentication to connect to SQL Server, specify a login with this argument. Also specify a password using the sqlpassword argument.

    If you are using Windows Authentication to connect to SQL Server, do not use the sqlusername and sqlpassword arguments.

    ms162764.security(en-US,SQL.90).gifSecurity Note:
    When possible, use Windows Authentication.
  • sqlpasswordsqlPassword
    Is the password associated with the sqlusername login. This argument must be used together with the sqlusername argument.
  • force
    Attempts to force the closure of any open database connections before deleting databases, without prompting the user. Without the force argument, if a database still has open connections, the nscontrol delete command cannot delete that database. The nscontrol delete command will attempt to delete all other databases for the instance.

    Note

    Using nscontrol delete without the force argument when some databases have open connections can leave the instance in an inconsistent state. Before you run nscontrol delete with the force argument, make sure to stop the NS$instance_name Windows service.

Remarks

The nscontrol delete command deletes the instance and application databases only if they were created by Notification Services. Use the nscontrol unregister command to remove the registry key, the performance counters, and any Windows service for the instance.

Permissions

The account used to run nscontrol delete, or the SQL Server login specified by the -sqlusername argument, must have permission to drop databases. This includes membership in the dbcreator or sysadmin fixed server role. The account must also have permission to execute the Notification Services binary files; this permission is granted to members of the Administrators and SQLServerNotificationServicesUser Windows groups.

Examples

A. Basic example

The following example shows how to delete the databases for an instance of Notification Services named StockInstance, using Windows Authentication to connect to SQL Server.

nscontrol delete -name StockInstance -server nsuetest

B. Forcing open connections to be closed and then deleting an instance

The following example shows how to force the closure of all open connections to the instance and application databases, without prompting the user, before deleting the databases. The nscontrol command uses Windows Authentication to connect to SQL Server.

nscontrol delete -name StockInstance -server nsuetest -force

C. Deleting an instance using SQL Server Authentication

The following example shows how to delete the databases for an instance of Notification Services named StockInstance, using SQL Server Authentication to connect to SQL Server.

nscontrol delete -name StockInstance -server nsuetest 
    -sqlusername SqlUser -sqlpassword sQl-P@sWd

See Also

Reference

nscontrol unregister Command
nscontrol Utility

Other Resources

Deleting Instances of Notification Services

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

5 December 2005

New content:
  • Added information about the SQLServerNotificationServicesUser Windows group.