Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sql Permission

Posted on 2016-09-25
6
Medium Priority
?
93 Views
Last Modified: 2016-10-27
Hi, I need to block if any one trying to create Stored Procedure and View.
even 'sa' users.
I understand it's need to be done Server Object-> Trigger.
0
Comment
Question by:ukerandi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:ste5an
ID: 41815003
Nope. You simply revoke that permissions from all users. And disable sa.
0
 
LVL 30

Expert Comment

by:Pawan Kumar
ID: 41816175
Create a role called "StoredProcedureRole" and provide CREATE PROCEDURE permission to that role.

Now assign that role to a user which you want to create stored procedures.

Now based on the roles you can allow users to perform operations..
0
 
LVL 30

Assisted Solution

by:Pawan Kumar
Pawan Kumar earned 1000 total points
ID: 41816198
Continue with the above comment.

yes you are right you can create a trigger. sample code

--

CREATE TRIGGER trgCreateStoreProcedure 
ON DATABASE FOR Create_Procedure 
AS 
BEGIN 
   IF IS_MEMBER('StoredProcedureRole') = 1 
   BEGIN 
       PRINT 'You cannot create procedure(s).'
       ROLLBACK TRAN
   END
END
GO

--

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 52

Accepted Solution

by:
Vitor Montalvão earned 1000 total points
ID: 41819307
You can simply deny the creation of those objects for the specific users:
USE databaseName
GO
DENY CREATE PROCEDURE TO [UserName]
DENY CREATE VIEW TO [UserName]

Open in new window

If you have many users you can just create a role where you include the users and for the above command replace UserName with that role name.
0
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 41839704
ukerandi, a feedback will be appreciated.
Cheers.
0
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 41860026
ukerandi, you are also an Expert and you should know that the etiquette is to return to the opened questions and give a feedback.
Please let us know if you still need help with this question.
Cheers
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question