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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Use different user account in Stored Procedure

Author  Topic 

Heinz23
Yak Posting Veteran

84 Posts

Posted - 2009-02-12 : 07:29:16
Hi all,

I have a stored procedure (AddLog) accessible for everyone. Now I want to add a new check to the existing stored procedure. Therefore it's necessary to query another table, but the accounts calling the stored procedure are not allowed to access this table. And I don't want to allow them to access it. Is is possible to use a dedicated account within my stored procedure so that this account queries the table?

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-12 : 07:50:49
Use EXECUTE AS in your stored procedure.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Heinz23
Yak Posting Veteran

84 Posts

Posted - 2009-02-12 : 09:53:57
I'll check that, thanks a lot!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-12 : 10:12:04
also see
http://bp-msbi.blogspot.com/2008/11/recently-i-had-to-implement-stored.html
Go to Top of Page
   

- Advertisement -