Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
chih
Posting Yak Master
154 Posts |
Posted - 2008-02-27 : 22:53:14
|
| Hi Everyone,I have problem in applying 'execute as'. Here is an exsample SPCreate procedure testwith execute as 'user1'asselect * from people.dbo.profileI have 2 accounts: user1 and user2. user1 has permission to select data from people.dbo.profile but user2 doesn't. due to some reasons I don't want to grant select permission to user2.I use user2 to execute this SP and get error messageThe server principal "user1" is not able to access the database "people" under the current security context.How can I solve it? I have been looking for solution for the whole morning.Thank you in advance. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-28 : 01:22:10
|
quote: Copied from Books Online
CREATE PROCEDURE dbo.usp_DemoWITH EXECUTE AS 'CompanyDomain\SqlUser1'ASSELECT user_name();GO
E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|