>I'm trying to move our audit activity file into a separate database on the same server. Moving it wasn't hard, but it is a series of keys, with a text field for description of the event. The hard part now is trying to figure out how to query it and get the data out of the other database that the keys really relate to. For example below, I'm trying to get the back data from the audit and the user name of based off the user key that is in the audit. The example below does not work, but it seems like it should somehow be possible. I'm running the query from the Query Analyzer right now, and I get the error:
>
>
>Invalid object name 'ctoredev.users'.
>
>
>ctoredev is the master database for the application.
>ctoreaudit is the audit database
>
>
>select AuditID,actionDT,UserID, actiontype,
> (select username from ctoredev.users where ctoredev.users.UserID=coAudit.UserID) as UserName
>from coAudit
>
>
>
>Thanks for any help. Maybe it's not possible and I'll just have to right the denormalized data into the audit, but I'm trying to avoid that.
>
>Kirk
Kirk,
You can specifiy the database a table belongs to:
from ctoredev..users
or with also qualifying the schema/owner:
from ctoredev.dbo.users
Cetin