I want to create a user in SQL Server 2008 R2, who should not have existing database access but can have access to create new database.
Tried the following steps:
--Step 1:
create LOGIN TestUser WITH PASSWORD='testuser123', CHECK_POLICY = OFF;
--Step 2:
USE master;
GO
DENY VIEW ANY DATABASE TO TestUser;
After login successfully, I went to create database but getting an error:
To be able to create a database you need to log into SQL Server using a login that has create database permissions.
Security - Logins
and then You need to double click on the user id for which you want to give the access of create database.
Right click your login and make it a dbcreator:
You can have a look into this.