SQL Server Create Database

sqlserver

Create database and user with fill rights

1
2
3
4
5
CREATE DATABASE [example];
CREATE LOGIN [example] WITH PASSWORD=N'MySecurePassword', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF;
USE [example]
CREATE USER [example] FROM LOGIN [example];
exec sp_addrolemember 'db_owner', 'example'

Drop database (AWS RDS Multi A-Z)

1
2
USE [master]
EXECUTE msdb.dbo.rds_drop_database  N'example'