1 if the user has access to the database
0 if the user does not have access to the database
NULL if the database does not exist
Find all databases that the current user has access to
SELECT [Name] as DatabaseName from master.dbo.sysdatabases
WHERE ISNULL(HAS_DBACCESS ([Name]),0)=1
ORDER BY [Name]
This query was written by a guy named safigi in sqlteamforums.
Did you like this post?
|subscribe via rss||subscribe via e-mail|
|print this post||follow me on twitter|