Is there a way to list an object name in a query where it's in another
database?
What I would like to do is have a select statement that lists processes
running (list locks actually) and have a column in the query for dbname
+ object name.
I'm not sure if you can do this in the select list though cause
Object_Name(ID) is current db specific. Is there a way to get
Object_Name() to look in a different database for the object's name
such as SELECT DB_Name(ID) + '..' + Object_Name(ID) AS DBAndObjectCan't you join on otherdb..sysobjects?
"Paul Sinclair" <paul.sinclair@.gmails.com> wrote in message
news:eNXwM2dTGHA.2156@.tk2msftngp13.phx.gbl...
> Is there a way to list an object name in a query where it's in another
> database?
> What I would like to do is have a select statement that lists processes
> running (list locks actually) and have a column in the query for dbname +
> object name.
> I'm not sure if you can do this in the select list though cause
> Object_Name(ID) is current db specific. Is there a way to get
> Object_Name() to look in a different database for the object's name
> such as SELECT DB_Name(ID) + '..' + Object_Name(ID) AS DBAndObject|||Aaron Bertrand [SQL Server MVP] wrote:
> Can't you join on otherdb..sysobjects?
>
>
> "Paul Sinclair" <paul.sinclair@.gmails.com> wrote in message
> news:eNXwM2dTGHA.2156@.tk2msftngp13.phx.gbl...
>
>
>
I could yes, but I don't know what database to join to. It could be any
of them. So I'm wondering if there is a way to dynamically
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment