April 5, 2007 at 2:16 am
Still trying to figure out if I can grant create procedure to a user so (s)he can create / alter / drop dbo owned userprocedures without that user being db_owner ?
-- logged on as alzdba (db_owner)
grant CREATE PROCEDURE TO alzuser ;
-- logged on as user alzuser (db_datareader)
create PROC dbo.[spc_1]
AS
BEGIN
SET NOCOUNT ON
SELECT *
FROM T1
END
--
Msg 2760
, Level 16, State 1, Procedure spc_1, Line 5
Specified owner name 'dbo' either does not exist or you do not have permission to use it.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
April 5, 2007 at 7:29 am
If you are doing this in a dev world, two ways:
1. Let them create objects and then "mark" them for dbo status. They do this by dropping the object name in a table you set up for them. Then you ahve a job that "renames" the table to have dbo as the owner (sp_changeobjectowner) . Run the job every minute, hour, whatever.
2. Let htem put schema/code in a table. Have a job that runs as dbo and "executes" the code. Be sure you trust the developers on this one.
I prefer the first.
April 5, 2007 at 12:02 pm
To create objects that will be owned by a different user, the database role db_ddladmin must be granted. To restrict what objects can be created, you may deny a statement privilege.
Here is some example SQL:
exec sp_addrolemember @rolename = 'db_ddladmin', @membername = 'LocalUser'
go
deny create table to LocalUser
go
SQL = Scarcely Qualifies as a Language
April 8, 2007 at 1:16 am
thank you all for the replies.
I'll test the proposed paths.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply