Geeks With Blogs
Nouman Zakir while (true) { Post.NewArticle(); }

HAS_DBACCESS returns information about whether the user has access to the specified database.


Example:
SELECT HAS_DBACCESS('Northwind');
returns
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]

Posted on Saturday, February 28, 2009 5:32 AM | Back to top


Comments on this post: Check access to databse in SQL Server

# re: Check access to databse in SQL Server
Requesting Gravatar...
Thats a gr8 stuff..thx a lot for the useful article..
Left by kapil vaichalkar on Jan 31, 2011 7:01 PM

# re: Check access to databse in SQL Server
Requesting Gravatar...
Getting familiar with the SQL server is quite tricky. I have had a similar issue a few months back. What I did at that time was reinstallation of the operating system. When I realized that it wouldn’t fix the problem, I contacted a technician. hotel catalina island
Left by Rahim on Sep 21, 2015 11:40 AM

Your comment:
 (will show your gravatar)


Copyright © Nouman Zakir | Powered by: GeeksWithBlogs.net | Join free