我创建了一个Windows组domain\group
并添加Windows用户domain\user1
到组。然后创建登录交叉数据库访问不适用于Windows组?
use master
create login [domain\group] for windows
use myDB
create user [domain\group] for login [domain\group]
grant select on schema::mySchema to [domain\group]
我启用了跨数据库访问
use master
EXECUTE sp_configure 'show advanced', 1;
RECONFIGURE with override;
EXECUTE sp_configure 'cross db ownership chaining', 1;
RECONFIGURE with override;
下面的语句作品。
exec ('select 1 a') as login = 'domain\user'
但是,选择访问另一个数据库中的表的视图时出现以下错误。
create view mySchema.view1 as select * from anotherDb.dbo.table1
go
exec ('select * from mySchema.view1') as login = 'domain\user'
Msg 916, Level 14, State 1, Line 1 The server principal "domain\user1" is not able to access the database "anotherDb" under the current security context.
您是否在另一个域中将域\组用户创建了组? – 2014-12-04 16:19:53
刚刚添加'use anotherDb;为登陆[domain \ group]创建用户[domain \ group]'。仍然得到了user1的错误 – ca9163d9 2014-12-04 16:26:35