Re: EXEC in stored procedure
From: Kalen Delaney (replies_at_public_newsgroups.com)
Date: 10/26/04
- Next message: Tom Moreau: "Re: EXEC in stored procedure"
- Previous message: Magnus Blomberg: "EXEC in stored procedure"
- In reply to: Magnus Blomberg: "EXEC in stored procedure"
- Next in thread: Tom Moreau: "Re: EXEC in stored procedure"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 26 Oct 2004 10:18:00 -0700
Hi Magnus
The dynamic select doesn't obey the same ownership chaining rules as
statements outside the EXEC. Users running the stored procedure must have
explicit permissions on the objects in the dynamic SQL.
A SELECT outside of the EXEC obey ownerships chaining rules, and any user
who has execute permission on procedure can run the statements in the
procedure, as long as the procedure and the table have the same owner.
Why do you need the EXEC? It serves no purpose here.
--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Magnus Blomberg" <magnus.blomberg@skanska.se> wrote in message
news:utP4%2373uEHA.4084@TK2MSFTNGP10.phx.gbl...
> Hello!
>
> I'm trying to use
> EXEC ('SELECT * FROM Categories')
> into a Stored Procedure, but the users get permission denied on object
> 'Categories'
> If I'm using
> SELECT * FROM Categories
> everything works.
> The user haven't any permission of Categories, but the SP should have it.
>
> Is the EXEC command inside the SP run as the user? Why?
>
> Regards Magnus
>
>
- Next message: Tom Moreau: "Re: EXEC in stored procedure"
- Previous message: Magnus Blomberg: "EXEC in stored procedure"
- In reply to: Magnus Blomberg: "EXEC in stored procedure"
- Next in thread: Tom Moreau: "Re: EXEC in stored procedure"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|