Sunday, February 19, 2012

how to access the info of a table created in other database

SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'tab_db1'

The above query will give the information of the table 'tab_db1' if it is available in the current database (say db1) connected.

How can i access the information of a table (say 'tab_db2') which is created under a different database say db2 from the current db connected say db1.

I tried the above query with changing the table_name to 'db2..tab_db2'
but went invain.

sysobjects also dint work..

Any help on this will be appreciated..

regards,
Sathya Vselect * from db2.information_schema.tables|||Thanks Tom, for answering my query!

No comments:

Post a Comment