Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Seek a way to identify which databases on different server a user has access to

$
0
0

Hello, I have a stored procedure (invoked by an MS Access front-end) that uses the following to identify the databases that the logged on user has access to:

Select name from master.sys.databases
WHERE HAS_DBACCESS(name) = 1;

This works fine for the server that contains the stored procedure, but I'd like to pass a parameter containing the name of a different server to this stored procedure, so that it can look at other servers to see what the user has access to.

It's easy enough to get a list of all databases on other servers.. example

Select name from [server].master.sys.databases

but I can't figure out how to get the system function HAS_DBACCESS to look at any server other than the one that contains the stored procedure that's running it.   Maybe I just can't use HAS_DBACCESS to do this?  Is there some other way of achieving what I seek?

Viewing all articles
Browse latest Browse all 23857

Trending Articles