-
I was wondering if anyone could tell me how to obtain a list of the available databases on an SQL Server, and also a list of tables inside of a particular database on the SQL Server. I am wanting to add them to a list box so that the user can choose his database and table from a dynamically updated list.
Any information would be greatly appreciated.
Thanks,
Green Onyx
-
List of databases (names):
Connect to "master" database(you must have permission)
"SELECT name FROM sysdatabases"
List of tables in database:
Connect to database
"SELECT name FROM sysobjects where type='U'"