(ventalinks@nospammers.com) writes:
Quote:
Plamen Ratchev wrote: Quote:
>Since both databases are on the same server, you can reference both in a
>single query (assuming user has permissions to both, etc.):
>>
>SELECT <columns>
>FROM Database1.dbo.TableA AS A
>JOIN Database2.dbo.TableB AS B
> ON A.keycolumn = B.keycolumn;
>>
>Note that each table is prefixed with database and schema name.
| >
>
Hello,
>
There are two different usernames and one has not access to the other
database. I am getting this error. I think this is do to access
privilige limitation:
>
>
The server principal "x" is not able to access the database "y" under
the current security context.
|
Before you do anything else, you should speak with your DBA. Maybe this
is just a case of malconfiguration. May the login x should be a user in
y as well. In that case, what Plamen suggested will work.
If the configuration is correct, you will need to set up a few things.
Or maybe rather someone with the powers-to-be will have to. There is a
longer article on my web site that discusses permissions in general,
including cross-database access:
http://www.sommarskog.se/grantperm.html
that should get you started.
--
Erland Sommarskog, SQL Server MVP,
esquel@sommarskog.se
Links for SQL Server Books Online:
SQL 2008:
http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:
http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinf...ons/books.mspx