Hiding databases for a login on Microsoft Sql Server 2008R2 and above

13,899
USE master;
GO
DENY VIEW ANY DATABASE TO [newlogin]; 
GO
USE yourDB;
GO
DROP USER newlogin;
GO
USE master;
GO
ALTER AUTHORIZATION ON DATABASE::yourDB TO [newlogin];
GO

Raj

Share:
13,899
Omgee Cares
Author by

Omgee Cares

I believe and Confess with my mouth before all mankind that Jesus Christ is Lord," and believe in my heart that GOD raised him from the dead

Updated on June 12, 2022

Comments

  • Omgee Cares
    Omgee Cares almost 2 years

    Please can anyone assist with hiding the available databases on sql server 2008R2 or newer versions.

    I have a new login user that I mapped to a specific database. When logging in with the specific login user I can see all the databases on the server, although I cannot access them except for the one I mapped to the login.

    This is 100% but my problem is that I do not want the login to even see that those other databases are available.

    How do I prevent those other databases that are not mapped to the login from displaying?