How to find Databases with its Table value
I want to find databases in the particular System.In the query i want to get a table value in tha database. i means , i created database, that database there a table with information about database ,they are StartDate,CloseDate,Description.In the databases diplay iwant to get these information also displays..How it possible?
Sam HobbsPosted Mar 18, 2011, 12:17 PM
Guest UserPosted Mar 18, 2011, 10:08 AM
To get a list of all databases and corresponding tables and columns, the following query will work:
sp_msforeachdb @command1='USE ?;SELECT * FROM INFORMATION_SCHEMA.Columns'
Sam HobbsPosted Mar 18, 2011, 1:31 AM
So you need to get StartDate, CloseDate and Description from a table in a database, correct? You created the database and you created the table, correct? Do you know what the name of the database is and the name of the table? If not, then why not?
Suthish NairPosted Mar 17, 2011, 1:48 PM
Guest UserPosted Mar 17, 2011, 9:20 AM
This will give you some information, and you can use the "database_id" column to join to the other sys tables to get more details on each database.