I create a procedure at datbase A and inside this procedure I do select to database B, table TA
How I must grant permission to user execute this procedure?
It returns
Msg 229, Level 14, State 5, Procedure PROCARENA02, Line 46The SELECT permission was denied on the object 'TA', database 'P12_REG08', schema 'dbo'.
I try use execute as owner but it returns
Msg 916, Level 14, State 1, Procedure xxx, Line 46
The server principal "PCS\dba" is not able to access the database "B" under the current security context.
The owner at procedure and tables are .dbo
And PCS\dba is a sysadmin ..