I want to validate the database and table name given in text box with the list of available database and table names on server. Is there any way so that I can retrieve the list of available database and table names, so that I can match them with the one given in text box.
Example - In text box I give [anyDatabaseName].[dbo].[anyTableName] with the list of available database and table names in same format.
I have databases like [database1]
and has tables like [database1Table1]
, [database1Table2]
, [database1Table3]
, so on. Similarly [database2]
has tables like [database2Table1]
, [database2Table2]
, [database2Table3]
, so on and I want to match database and table name given on whole in text box with the list available on server.
UPDATE: this has helped me little
but I don't want system databases and I also want ids of databases, I will be gathering all information and then inserting that info in single table.