Re: Run an SP as another user

From: BP Margolin (bpmargo@attglobal.net)
Date: 06/05/02


From: "BP Margolin" <bpmargo@attglobal.net>
Date: Tue, 4 Jun 2002 22:29:53 -0400


Craig,

To the best of my knowledge, the security context of a stored procedure is
that of the user that created the stored procedure, and that can not be
changed.

-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.

"Craig" <craig@reliancenetwork.com> wrote in message
news:etz#BfDDCHA.2096@tkmsftngp04...
> I want to create a stored procedure, but the user that needs to execute it
> doesn't have permissions to execute some of the statements in it.
>
> Is there a way to have the SP run as a different user. Like a statement
at
> the beginning of the SP to change the user to someone with permissions,
then
> at the end of the SP, change it back...or something like that.
>
> Please help. Thanks.
>
>
>



Relevant Pages

  • Re: Logon failed for user ". but only for membership tables in same database that other request wor
    ... I was able to log on to computer b and execute the stored procedure. ... was no error after I corrected the permissions for the user. ... I can access the stored procedure but I can not use membership.validateuser. ... You may use the GRANT statement to grant the EXECUTE permission for a ...
    (microsoft.public.sqlserver.security)
  • Re: Executing dynamic select statement in a SP
    ... EXECUTE permissions for a stored procedure default to the owner of the ... the statementwithin the EXECUTE string are checked at the time EXECUTE ... > everything works just fine but with dynamic SQLs when I ...
    (microsoft.public.sqlserver.security)
  • With in a SP Truncate dbo.table table-name permissions..
    ... If i give execute permission to this ... truncate table permissions on the table. ... If a user who creates a stored procedure does ... not qualify the name of the tables referenced in SELECT, ...
    (microsoft.public.sqlserver.security)
  • Re: SET IDENTITY_INSERT Privileges?
    ... on the stored procedure to get around this. ... stored procedure and the user has execute permissions on the ... How do I grant permission to a SET Statement?? ...
    (microsoft.public.sqlserver.security)
  • Re: app role has exec permission but still cant execute sp
    ... that the stored procedure references in it's code. ... ADO connection sometimes opens a new connection to the server if the first ... > The stored procedure which I can't execute is below, ... >>> well as some users with no permissions. ...
    (microsoft.public.sqlserver.security)