>Sql Server: Hide Database Name from Specific User in SSMS
Recently,I have tried my best to find out a way to hide name of databases from Sql Server Management Studio, which I don’t want to show to a specific user. But unfortunately I can’t find any proper way to achieve my goal.
You can hide all databases from a specific user by using following statement
DENY VIEW ANY DATABASE TO [TargetUserNameHere];
And same way by using GRANT, you can allow your user to view ALL databases. Optimum solution I have found is to hide database objects (even name of TABLES, VIEW, SPs & FUNCTIONS) ONLY, by using following statement
DENY VIEW DEFINITION TO [TargetUserNameHere]
or you can use
DENY VIEW DEFINITION ON DATABASE:: YourDatbaseNameHere TO [TargetUserNameHere]
So is there any way to hide a specific database name & definition (NoT ALL DATABASES) from a specific user?