Re: Execute AS DBO



pardhiveswar via SQLMonster.com (u8956@uwe) writes:
CREATE procedure [dbo].[usp_SelectTable]
with execute as 'dbo'
as
select top 1 *
from LS_FAIL.master.dbo.syslogins

ls_fail is the liked server name and i am using 3rd option under linked
server security

HI i am not able to query the above stored procedure using EXECUTE AS DBO

i am getting error like Msg 18456, Level 14, State 1, Line 1
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

When you impersonate a user, which is what you do here, you are
sandboxed into the current database, and cannot perform actions outside.

To change this, you can make the database trustworthy:

ALTER DATABASE db SET TRUSTWORTHY ON

Making a database trustworthy is non-controversial, if you are the DBA and
and the database owner. But if the database owner is not sysadmin,
there is all reason to be careful with making the database trustworhy,
since it opens a couple of doors for the database owner.

Rather than using EXECUTE AS, it may be better to use certificate signing
to achieve what you want to do. I have an article on my web site that
discusses this in detail: http://www.sommarskog.se/grantperm.html.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

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/prodinfo/previousversions/books.mspx

.



Relevant Pages

  • RE: Backups have Shadow Copy Problems
    ... and restarted the server. ... suggested and changed the recovery model to simple on the one database called ... I understand the issue to be: the backup task failed ... You back up data from a volume that contains a Microsoft SQL Server ...
    (microsoft.public.windows.server.sbs)
  • Re: upsizing to sql 2005
    ... the word SERVER in it, ... You can access to the database by multiple means (Access, ... and how does it update the SQL database with the new records in Access? ... Query Name: Arcadia - ARC ...
    (microsoft.public.access.queries)
  • Re: Linked Tables in Access
    ... any use of SQL Passthru, Linked Tables or any other use of MDB / MDE ... server, or would I also need to convert *those* queries to passthrough ... I've been trying to understand why Access database files become corrupt. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Leveling by ID vs. "Standard"
    ... of this trade called Project Management. ... a database for the "Project Tables," ... to write reports on data from the server database. ... product supporting queries created with SQL. ...
    (microsoft.public.project)
  • Re: Trouble Getting VS.Net 2003 WalkThroughs MSDE Connection
    ... Config Tool of SQL Server? ... > link to download the PUBs database. ... >>> Setup and they directed me to install MSDE and they attached a ...
    (microsoft.public.sqlserver.msde)

Quantcast