Re: cross database query with ownership chaining
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Tue, 27 May 2008 14:42:14 -0700
Mark (marksullivan@xxxxxxx) writes:
I want a SQL Account called SQLUser to call a stored
procedure in my non-CRM database to invoke a view that will perform the
union. The SQLUser has been granted Impersonate for
'''mydomain\WindowsUser'.
But exactly how did you do this? Did you say:
GRANT IMPERSONATE ON USER::[mydomain\WindowsUser] TO SQLUser
or did you:
GRANT IMPERSONATE ON LOGIN::[mydomain\WindowsUser] TO SQLUser
Since you do EXECUTE AS LOGIN when you impersonate, you must do the latter.
When I use the command, EXECUTE('EXECUTE AS LOGIN =
''mydomain\WindowsUser'';execute mydatabase..myprocedure) When not set to
sysadmin here is the error:
You could also do:
EXECUTE('EXECUTE mydatabase..myprocedure')
AS LOGIN = 'mydomain\WindowsUser'
to avoid a few extra single quotes.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- cross database query with ownership chaining
- From: Mark
- cross database query with ownership chaining
- Prev by Date: Re: Howto troubleshoot login failure - State 11?
- Next by Date: Re: Grant access to applications only
- Previous by thread: cross database query with ownership chaining
- Next by thread: RE: cross database query with ownership chaining
- Index(es):
Relevant Pages
|