Re: How to I get a list of databases?



But don't you have to have permission to access master.dbo.sysdatabases?

I am wondering because if I connect to my ISP's SQL server using
Enterprise Manager, EP will only show me the databases that I own or
have permission to access.

Since I don't have admin rights to their server, I'm wondering how EP
was able to deduce which databases I can access.

--Dave

In article <OYvBBwVzHHA.4928@xxxxxxxxxxxxxxxxxxxx>, reb01501
@NOyahoo.SPAMcom says...
Dave Navarro wrote:
How can I get a list of databases in an SQL server that I have
permissions for?

You can get a list of databases by querying the master.dbo.sysdatabases
table. Depending on the version of SQL Server you are using, there are other
ways as well.

Then, to determine which ones you have permissions for, I guess you would
need to loop through the list of names and attempt to open a connection to
each one in turn, catching the error if it fails.


I have used ADOX to get a list of tables in a database, but I can't
find any sample ADOX code for getting a list of databases on a server
that I can access.

That's because ADOX is geared to work with a single database at a time: its
top-level object is the Catalog, i.e., database.
.



Relevant Pages

  • Re: Moving SQL Objects
    ... Moving SQL Server databases to a new location with Detach/Attach ... Transfer Logins and Passwords Between Instances of SQL Server ... How to Resolve Permission Issues When a Database Is Moved Between SQL ...
    (microsoft.public.sqlserver.server)
  • Re: Moving SQL Server Components
    ... Moving SQL Server databases to a new location with Detach/Attach ... Transfer Logins and Passwords Between Instances of SQL Server ... How to Resolve Permission Issues When a Database Is Moved Between SQL ...
    (microsoft.public.sqlserver.server)
  • Re: Moving SQL objects
    ... Moving SQL Server databases to a new location with Detach/Attach ... Transfer Logins and Passwords Between Instances of SQL Server ... How to Resolve Permission Issues When a Database Is Moved Between SQL ...
    (microsoft.public.sqlserver.server)
  • Re: problem with login list
    ... I'm using the 64-bit version of SQL Server 2005, SP2, on Windows ... their different respective databases. ... We have hundreds of logins on the ... is no permission VIEW ANY LOGIN, but there is a server-level VIEW ANY ...
    (comp.databases.ms-sqlserver)
  • Re: why>?
    ... On your desktop-- you'll be running SQL Server behind the scenes. ... it isn't risky to allow end users to create databases. ... it is no more risky than giving you the ability to create spreadsheets. ... I'm not saying that Oracle and IBM are going away. ...
    (microsoft.public.excel)