Wednesday, March 7, 2012

Getting List of Database

I have a 2 query here ;

1. That get's all the Database in a Server (a)

2. Get's all Table in Database (b)

but the problem i ha

a.)

SELECT

table_name=sysobjects.name

FROM sysobjects

where sysobjects.xtype='U'

b.)

select * from master.dbo.sysdatabases

order by name, dbid

Is there anyway i can join this query

ex. Database containing list of tables

Thanks

OK, as there two having different scope, one server level and other database level, so these two dont have direct join. We can help you, if you tell us, what exactly you want to achive? Why to join thses two object?

Gurpreet S. Gill

|||

We have a test application that populate the list of database in the Dropdown table, then base on the given database we can now populate the list of table name.

is this ok?

thanks for the reply

|||

1) select Name from master.dbo.sysdatabases

2)If user selects Notrthwind then generate the following query..

select Name from Northwind.dbo.Sysobjects where type='U'

|||

this gives u all u want..i guess..!!

select * from information_schema.tables

|||Thanks it works!!! |||Thanks

No comments:

Post a Comment