PDA

Click to See Complete Forum and Search --> : Database/Table List in SQL Server


gonyx
Nov 8th, 2000, 12:46 PM
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

Maxi
Nov 8th, 2000, 04:46 PM
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'"