lunes, 16 de julio de 2012

Ocultar bases de datos sql

------------ BEGIN SQL -------------------

USE [master]
GO
-- make sure they can view all databases for the moment.
GRANT VIEW ANY DATABASE TO UserLoginName_HERE
GO

USE DataBaseName_HERE
go

-- drop the user in the database if it already exists.
IF EXISTS (SELECT *
FROM sys.database_principals
WHERE name = N'UserLoginName_HERE')
DROP USER UserLoginName_HERE
GO

-- grant them ownership to of the database (ownership of dbo schema).
ALTER AUTHORIZATION ON DATABASE::DataBaseName_HERE to UserLoginName_HERE
go

USE MASTER
go

-- deny ability to see ohter databases
DENY VIEW ANY DATABASE TO UserLoginName_HERE
go

------------ END SQL -------------------

No hay comentarios:

Publicar un comentario