Thursday, December 30, 2010

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
USE MASTER
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
USE YourDatbaseNameHere
GO
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? 

1 comment:

  1. hi please suggest me how to hide particular table and view in sql sever 2008 database
    please mail me soluiton nnnlaxman12@gmail.com

    ReplyDelete

All suggestions are welcome