Dropping a database |
[This is preliminary documentation and is subject to change.]
How to drop an existing database, that is no longer needed - using command line scripts.
![]() |
---|
If the version of the framework is 4.25 or later, it is recommended to use the Administration Module to drop databases. This is much easier than using command line scripts. |
Dropping a database is very easy using SQL Server Management Studio. So why have a special script for this?
Having this script makes it easier to test creating and updating databases using command files (aka. batch files).
This scripts "knows" about the 2 logins that are normally created for each TOPICA database. Using this script to drop a TOPICA database will drop the corresponding logins.
Prerequisite: a login/password that gives "drop database" and "drop login" permission on the database server (i.e. the deployer cannot use this procedure in a "managed" production environments).
Open a command prompt and navigate to the folder containing the command scripts. In this command prompt, enter the command BuildTopicaCore (with no parameters). The command prompt will display:
DropDatabase Missing parameter(s) - expected: Server Username Password DatabaseName Server: Servername (use "." or "localhost" for current machine) Username: Login used for dropping database, logins, etc. For trusted connection (= Windows authentication): use "*" Password: Password for login used for dropping database, logins, etc. For trusted connection (= Windows authentication): use "*" DatabaseName: Name of the database to be dropped.
Examples:
DropDatabase MyServer sa sapassw MyApp1Prod
Drop the previously created database "MyApp1Prod" and the associated logins "MyApp1Prod_AdminLogin" and "MyApp1Prod_AppLogin" using SQL Server login "sa" and password "sapassw".
DropDatabase MyServer * * MyApp2Prod
Drop the previously created database "MyApp2Prod" and the associated logins "MyApp2Prod_AdminLogin" and "MyApp2Prod_AppLogin" using Windows authentication.