Groups | Blog | Home
all groups > sql server programming > september 2003 >

sql server programming : how to get the list of databases a specific user has access to ?


mariahzhu
9/6/2003 4:08:21 PM
I need to figure out in my C# code the list of databases a
specific SQL Server user has access to on a certain
server. Is there a system store procedure to do that? I
found sp_helplogin and sp_helpuser. But neither gives the
Dinesh.T.K
9/6/2003 9:10:35 PM
Mariahzhu,

SELECT catalog_name AS 'Database Name'
FROM INFORMATION_SCHEMA.SCHEMATA AS ISS
WHERE HAS_DBACCESS( ISS.CATALOG_NAME ) = 1

--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com

[quoted text, click to view]

AddThis Social Bookmark Button