Hello Forum
I'm having issues with the EXECUTE AS with stored procedures. Esssentially I have ended up creating a new user, giving this user execute permissions on both stored procedures and giving the user full read/write access and access to the dbo schemas in both databases.
Following test procedure has been created in the first database: -
CREATE PROC [dbo].[SPCM_DBP_CreateReportedEmail] WITH EXECUTE AS 'MultiDBUser'
AS
BEGIN
EXEC DBPorter_LiveCopy.dbo.test
END
Following test procedure has been created in the other database: -
USE [DBPorter_LiveCopy]
GO
CREATE PROCEDURE [dbo].[Test]
AS
BEGIN
Select name into #temp from sys.sysobjects where type = 'u'
Select * from #temp
END
If I run the Test procedure as the MultiDbUser then it works just fine however when I run SPCM_DBP_CreateReportedEmail which calls the Test procedure it returns the error 916.
Some suggested solutions have not resolved the issues, these include "Enable Cross Database Chaining", removing the Database Collation column from Databases View in SSMS and updating the user (superflous as I created the user for testing purposes) are just a few things.
Platform is SQL Server 2005 Std Edition 32Bit SP4.
MultiDbUser has read/write access to both Servers and EXEC permissions for both stored procedures. I've also tried EXECUTE As 'dbo' and EXECUTE As 'sa' and had the same problems.
Can anyone please offer any help on this? Many thanks
Please click "Mark As Answer" if my post helped. Tony C.