How do you display a list of tables in another database?
2 answers
This is for me (MS SQL 2005 and newer):
select * from your_database_name.sys.tables
Be aware that you (or whatever authentication context you are using) still needs read permission on this database.
To use your example:
use a;
go
select * from sys.tables; -- selects table info from a
select * from b.sys.tables; -- selects table info from b
+16
source to share