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 |
sathyav
Starting Member
27 Posts |
Posted - 2006-08-24 : 07:33:12
|
[code]SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'tab_db1' [/code]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 VToday will be Yesterday Tomorrow - Do it now |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-08-24 : 07:38:52
|
Select * From db2..[Sysobjects] where type = 'U'Chirag |
|
|
sathyav
Starting Member
27 Posts |
Posted - 2006-08-24 : 07:44:06
|
Thanks for the reply chirag,will it not be possible to use information_schema.tables for the purpose...regards,Sathya VToday will be Yesterday Tomorrow - Do it now |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-08-24 : 08:27:49
|
It is possible as shown below..SELECT * FROM DB.INFORMATION_SCHEMA.TABLES Harsh AthalyeIndia."Nothing is Impossible" |
|
|
sathyav
Starting Member
27 Posts |
Posted - 2006-08-24 : 12:13:38
|
Thanks for answering my query Harsh, it worksToday will be Yesterday Tomorrow - Do it now |
|
|
|
|
|