Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mgkind
Starting Member
8 Posts |
Posted - 2004-09-18 : 08:23:15
|
| I would be very pleased if I know how can I retrieve the database names of one sql server by query?I want to use it programmatically!Is there any query for getting the database name of one sql server 2000 's serve?thanks mgkind |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-09-18 : 08:49:45
|
| SELECT name FROM master..sysdatabases |
 |
|
|
mgkind
Starting Member
8 Posts |
Posted - 2004-09-19 : 04:37:05
|
| tanks robvolkand below is the other codes for getting table list of one db:SELECT name FROM sysobjectswhere type='U'order by name |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-09-20 : 07:04:32
|
or use select table_name from information_schema.tables |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-09-20 : 07:15:38
|
| I recommend the use of the information_schema views:SELECT CATALOG_NAME FROM INFORMATION_SCHEMA.SCHEMATAAlso see:SELECT DB_NAME(), DB_ID()rockmoose/* Chaos is the nature of things...Order is a lesser state of chaos */ |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-09-21 : 00:26:30
|
quote: Originally posted by jen or use select table_name from information_schema.tables 
--editsorry didn't read the question clearly, duh, what was i thinking? |
 |
|
|
|
|
|