Database List Hardcoded into SQL Server Management

Hi,
i'm working on the rtm version of mssql 2005 and i'm wondering to find that the database list are hard coded into SQL Server Management.
I need to hide databases list for (newbie) users on EM 2000 i can hide this list using this kbhttp://support.microsoft.com/?id=889696 but on the new SQLSM

The database list is hard coded into this batch query

SELECT

dtb.nameAS [Database_Name],

'Server[@Name='+quotename(CAST(serverproperty(N'Servername')ASsysname),'''')+']'+'/Database[@Name='+quotename(dtb.name,'''')+']'

AS [Database_Urn],

case

-- if all these are false then we are in the Normal state

-- except some return NULL if it's AutoClosed

when(DATABASEPROPERTY(dtb.name,'IsInLoad')= 0and

(DATABASEPROPERTY(dtb.name,'IsInRecovery')= 0orDATABASEPROPERTY(dtb.name,'IsInRecovery')isnull)and

(DATABASEPROPERTY(dtb.name,'IsNotRecovered')= 0orDATABASEPROPERTY(dtb.name,'IsNotRecovered')isnull)and

DATABASEPROPERTY(dtb.name,'IsSuspect')= 0and

DATABASEPROPERTY(dtb.name,'IsOffline')= 0and

DATABASEPROPERTY(dtb.name,'IsInStandBy')= 0and

(DATABASEPROPERTY(dtb.name,'IsShutDown')= 0orDATABASEPROPERTY(dtb.name,'IsShutDown')isnull)and

DATABASEPROPERTY(dtb.name,'IsEmergencyMode')= 0)then 1

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsInLoad')= 1then 2

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsInRecovery')= 1and

DATABASEPROPERTY(dtb.name,'IsNotRecovered')= 1then 4

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsInRecovery')= 1then 8

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsSuspect')= 1then 16

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsOffline')= 1then 32

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsInStandBy')= 1then 64

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsShutDown')= 1then 128

whenDATABASEPROPERTY(dtb.name,'IsShutDown')isnullthen(512+ 128)

else 0

end|

case

whenDATABASEPROPERTY(dtb.name,'IsEmergencyMode')= 1then 256

else 0

end

AS [Database_Status],

dtb.cmptlevelAS [Database_CompatibilityLevel],

CASEDATABASEPROPERTYEX(dtb.name,'Recovery')WHEN'SIMPLE'THEN 3WHEN'BULK_LOGGED'THEN 2ELSE/*FULL*/ 1ENDAS [RecoveryModel],

CASECONVERT(sysname,DATABASEPROPERTYEX(dtb.name,'UserAccess'))WHEN'SINGLE_USER'THEN 1WHEN'RESTRICTED_USER'THEN 2ELSE/*MULTI_USER*/

0ENDAS [UserAccess],

CAST(DATABASEPROPERTY(dtb.name,'IsReadOnly')ASbit)AS [ReadOnly],

dtb.nameAS [Database_DatabaseName2]

FROM

master.dbo.sysdatabasesAS dtb

WHERE

(CAST(casewhen dtb.namein('master','model','msdb','tempdb')then 1else category& 16endASbit)=0)

ORDERBY

[Database_Name]ASC

So my question it's possible to have a stored procedure on the next fix of mssql 2005 with a stored procedure on the master database to show the database list, i know that the database are listed on the table master.dbo.sysdatabases but i need to hide database for newbie users.

[22145 byte] By [ChristianPaparelli] at [2008-2-22]
# 1
If your question is related to Management Studio, please post to SQL Server Tools General.

If you don't want a user to be able to see all entries of sys.databases/sysdatabases, then you can just deny VIEW ANY DATABASE permission to them. By default, this permission is assigned to public (for backward compatibility with SQL Server 2000), so every principal has it.

Thanks
Laurentiu

LaurentiuCristofor at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Security...
# 2
Hi Laurentiu,
yes the question is related to Management Studio and i'll post on the correct forum.
Thank's
ChristianPaparelli at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Security...
# 3

Note: with SP2 client, DENY VIEW ANY DATABASE TO <login> results in NO, NONE, NATA databases other than master and tempdb being visible in object explorer. The problem is clearly that SSMS calls master.dbo.databases - if it would just call dbo.databases (using the login's default database) then all the databases the user has access to might be listed. I will check the other forum for help, but MS PM's- if you're listening- this is terribly annoying.

Yes, I have tried adding the logins as users in master, then granting select on the system view- deny view any database permission trumps it. Also, why is there no [GRANT/REVOKE/DENY] VIEW DATABASE::<dbname> syntax?!!!

Other than permissions, and their quirks such as this, SQL Server is a great product.

MichaelSmith at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Security...

SQL Server

Site Classified