# Database Cheat Sheet ## Restore Databases * Login to **SQL Management Studio** * Right click on the database you're going to restore * Select **Delete** * CHECK THE **CLOSE EXISTING CONNECTIONS** CHECKBOX * Select **OK** * Right click on the **Databases** directory * Select **Restore Database...** * Select the **Device** radio button * Select **...** at the end of the **Device** selection * Select the **Add** button * Go to the **D:\Work\mobile-clock-qa\databases** path * Select which database you'd like to restore * Select **OK** > **OK** > **OK** > **OK** * The database you selected should now show up in the list under the **Databases** directory ## Backup Databases After you have made your changes to the database... * Go to **C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup** and delete the database you are about to backup * Login to **SQL Management Studio** * Open the **Databases** directory and right clock on the database you want to backup * Select **Tasks** > **Back Up...** * Verify the database is correct and select **OK** > **OK** * Go to **D:\Work\mobile-clock-qa\databases** and delete the database you're going to be replaceing * Go to **C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup** and copy your backup * Paste that backup in **D:\Work\mobile-clock-qa\databases** * Rename backup to **[databasename].bak**.