Friday, February 24, 2012

List of accessible databases on a server

Hi All
I once saw this app that allowed you to pick a SQL server and provided your
signon details; it then displayeda list of DBs on that server which you had
access to with the provided signon.
Does anybody know how they did this? How they got the list of databases off
the server?
ThanksHi
EXEC sp_MSForEachDB "use ? select '?' as dbname, name as username from
sysusers where islogin = 1 and hasdbaccess = 1"
"Chan" <Chan@.discussions.microsoft.com> wrote in message
news:B87B3DDC-4F51-4810-959A-96CFB27E93BD@.microsoft.com...
> Hi All
> I once saw this app that allowed you to pick a SQL server and provided
> your
> signon details; it then displayeda list of DBs on that server which you
> had
> access to with the provided signon.
> Does anybody know how they did this? How they got the list of databases
> off
> the server?
> Thanks|||You could start with:
SELECT name FROM master..sysdatabases
"Chan" <Chan@.discussions.microsoft.com> wrote in message
news:B87B3DDC-4F51-4810-959A-96CFB27E93BD@.microsoft.com...
> Hi All
> I once saw this app that allowed you to pick a SQL server and provided
> your
> signon details; it then displayeda list of DBs on that server which you
> had
> access to with the provided signon.
> Does anybody know how they did this? How they got the list of databases
> off
> the server?
> Thanks

No comments:

Post a Comment