Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a database in SQL Server 2008 and it shows in server object explorer to all users that can login to SQL.

I want to hide it from those users, I want it to be viewable by me only.

How can I do that? Any help, suggestions?

Many thanks

share|improve this question

migrated from stackoverflow.com Mar 11 '11 at 10:02

This question came from our site for professional and enthusiast programmers.

    
As far as I know, you cannot do this in SQL Server Management Studio. Everyone sees all databases - whether they can use anything inside them or not. – marc_s Mar 10 '11 at 14:21
    
Just because they can see it, it doesn't mean they can access it. If you need to hide the existence of a database from other users, use a separate server (or instance) – Damien_The_Unbeliever Mar 10 '11 at 14:23
    
possible duplicate of Setup a SQL Server database that's only visible to certain users – p.campbell Mar 10 '11 at 14:35

Try this: In SQL Server Management Studio, right click the server and click "Properties". Click on "Permissions" and then select the "Public" role and remove "Grant" from "View Any Database".

share|improve this answer
    
+1 neato ! Great tip, thanks! – marc_s Mar 10 '11 at 14:29

USE master; GO

DENY VIEW ANY DATABASE TO [loginname]; GO

USE [your db]; GO

DROP USER [loginname]; GO

USE master; GO

ALTER AUTHORIZATION ON DATABASE::[your db]TO [loginname]; GO

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.