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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using OBJECTPROPERTY on remote databases

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-08 : 08:30:29
Steve writes "Hi there

I want to run a query like this to find all the user tables on a database that is not the current one.

select [table_name]
from <database>.information_schema.tables
where OBJECTPROPERTY(object_id([table_name]), 'IsUserTable')=1

This doesn't work because OBJECTPROPERTY only works on the current database. Unfortunately, at runtime, I don't know what database this is going to be run for (this is part of a Stored Procedure) and as USE doesn't take a variable as an argument I don't see how I can do this..

Any thoughts?

Thanks

Steve

PS - WinNT4 Sp6, SQL Server 7.0"
   

- Advertisement -