Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Step 1: (create a new user)
- create LOGIN hello WITH PASSWORD='foo', CHECK_POLICY = OFF;
- -- Step 2:(deny view to any database)
- USE master;
- GO
- DENY VIEW ANY DATABASE TO hello;
- -- step 3 (then authorized the user for that specific database , you have to use the master by doing use master as below)
- USE master;
- GO
- ALTER AUTHORIZATION ON DATABASE::yourDB TO hello;
- GO
- USE [yourDB]
- CREATE USER hello FOR LOGIN hello WITH DEFAULT_SCHEMA=[dbo]
- GO
- USE yourDB;
- GO
- DROP USER newlogin;
- GO
- USE master
- go
- DENY VIEW ANY DATABASE TO [user]
- go
Add Comment
Please, Sign In to add comment