SQL 2012 :: Granting Permissions To Execute Stored Procedure

Apr 28, 2015

I have stored procedures. I have heard that it is a best practice to use stored procedures to encapsulate some SQL statements and then grant permissions to execute the stored procedure. But when I try this and use EXECUTE AS to test it out, the user in question gets errors about not having access to some of the underlying objects.

How does this best practice work? If I need to grant the user permissions to the underlying objects anyway, I am not sure why a stored procedure is considered best practice in this regard.

View 8 Replies


ADVERTISEMENT

Granting Stored Procedure Execute Permissions From ASP.NET?

Nov 21, 2005

Bit of an emergency!

I do not have direct access to our SQL Server but I have full FTP access to the web server and have the db Username/passwords.

I need to grant execute permissions on a stored procedure, can I do this from an asp/ASP.NET page?

The DB guys take 24 hours to run a script against the database!

Any help would be greatfully recieved.

Rich

View 1 Replies View Related

SQL Server 2008 :: Granting Explicit View Definition Permissions On Stored Procedure To DBO?

Mar 6, 2013

The developers in our shop have a need to explicitly grant view definition permissions to themselves on stored procedures they create in their development databases. They have dbo level permissions in these databases and although they can explicitly grant view definition permissions to other developers in the same database, they are unable to do so for themselves. When they attempt this, it appears that they are successful but when they check the stored procedure afterwards the permission is not there for themselves.

While this does not cause an issue in development, the intention is for these view definition permissions to be carried forward to the test and production databases where they only have datareader permissions.

When these stored procedures are scripted out by the dba to move to Test and Production the view definition permissions are not scripted out for the developer in question.

Is there a way that a developer with dbo rights in a database can explicitly grant themselves view definition permissions on a stored procedure they create as dbo?

View 9 Replies View Related

Stored Procedure Create & Execute Permissions

Aug 27, 2002

In our development and test environments the developers need to create and execute stored procedures as dbo without having any other dbo permissions. If I place them in db_owner, they have too many permissions. Is there a way to address this situation?

I'm also curious how other companies address the subject of creating stored procedures in development and test environments. If I give developers create and execute permission in a database, all objects would be created as JohnDoe.storedprocedurename instead of dbo.storedprocedurename. Any help in this area is appreciated.

Dave

View 1 Replies View Related

SQL 2012 :: Extended Stored Procedure Permissions

Jan 15, 2015

I am logging into a SQL instance to run the following query:

DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_create_subdir N'sharemasterFULL' IF @ReturnCode <> 0 RAISERROR('Error creating directory.', 16, 1)

The share in which the folder is to be created has my account added with full permissions to create files. However this command fails unless I add the SQL Service account user with rights to the folder also.

Is this expected behaviour, is this something specific to extended stored procedures?

View 0 Replies View Related

SQL 2012 :: Assign Create Stored Procedure Permissions?

May 6, 2014

Only to a specific schema? Can this be done?

View 5 Replies View Related

SQL 2012 :: Access Rights To Execute Stored Procedure If There Is No DML Involved

Jul 2, 2014

I would like to provide the db_datareader and db_executor role to a particular SQL Server Login in a database
But, I would like to avoid any INSERT's, UPDATE's or DELETE's that may happen by calling the stored procedures

I tried assigning the db_denydatawriter role but it doesn't seem to be doing the trick as the INSERT's, UPDATE's and DELETE's were still working

Is there any way to provide the db_datareader and db_executor role but avoid any DML actions.

View 7 Replies View Related

SQL 2012 :: SSIS - Execute Stored Procedure With Parameters Does Not Work

Jun 9, 2015

Using the following:

SQL Server: SQL Server 2012
Visual Studio 2012

I have created an SSIS package where I have added an Execute SQL Task to run an existing stored procedure in my SQL database.

General:
Result Set: None
Connection Type: OLE DB
SourceType: Direct Input
IsQueryStoredProcedure: False (this is greyed out and cannot be changed)
Bypass Prepare: True

When I use the following execute statement where I am "Hard Coding" in the parameters, the stored procedure runs successfully and it places the data into the table per the stored procedure.

SQLStatement: dbo.sp_ml_location_load @system_cd='03', @location_type_cd=Store;

However, the @system_cd parameter can change, so I wanted to set these parameters up as variables and use the parameter mapping in the Execute SQL Task.

I have set this up as follows and it runs the package successfully but it does not put the data into the table. The only thing I can figure is either I have the variables set up incorrectly or the parameter mapping set up incorrectly.

Stored procedure variables:

ALTER PROCEDURE [dbo].[sp_ml_location_load]
(@system_cd nvarchar(10), @location_type_cd nvarchar(10))
AS
BEGIN .....................

Here is my set up, what is wrong here:

I Created these Variables:

Name Scope Data Type Value
system_cd Locations String '03'
location_type_cd Locations String Store

I added these parameter mappings in the Execute SQL Task

Variable Name Direction Data TypeParameter NameParameter Size
User::system_cd Input NVARCHAR@system_cd -1
User::location_type_cd Input NVARCHAR@location_type_cd -1

I used this SQLStatement: EXEC dbo.sp_ml_location_load ?,

It runs the package successfully but it does not put the data into the table.

View 2 Replies View Related

SQL 2012 :: Allow Low Privilege User To Execute Stored Procedure To Create DB Users

Jul 22, 2014

I have a requirement to allow a user to restore a database and then create database users and add them to the db_owner database role. The user must not have sysadmin rights on the server.

The database restore works ok by placing the user in the dbcreator role.

There is a stored procedure to create the database user and alter role membership, I want the user to execute the sp as a different, higher privilege account so as not to give the user underlying permission to create users in the database.

USE [master]
GO

/****** Object: StoredProcedure [dbo].[sp_create_db_users] Script Date: 22/07/2014 13:54:46 ******/
SET ANSI_NULLS ON
GO

[Code] ....

The user has execute permission on the stored procedure but keeps getting the error:

Msg 916, Level 14, State 1, Line 2

The server principal "Mydomainadmin1" is not able to access the database "Mydatabase" under the current security context.

Mydomainadmin1 has dbowner to Mydatabase and sysadmin rights for server. If the 'execute as' is changed to 'caller' and run by mydomainadmin1 it works so the issue is between the execute sp and the actual running of the procedure.

View 1 Replies View Related

Granting Permissions

Dec 6, 2001

I am trying to grant permission to one table for one individual and one group. I tried to accomplish this by simply going in and editing the permissions on the table through Enterprise Manager. It keeps getting stuck. I then ran the Grant select on (table name) to the group and it has been running for over 15 minutes. This should be something that is done relatively quickly.

Any advice would be great.

Thanks

View 1 Replies View Related

Granting Permissions

Mar 29, 1999

i was asked by a user this morning to create an ID for him and give the ID SELECT permissions to all tables in a database. This database has over 300 tables. The only way that I could see to do this is to use the Object Permissions dialog box and manually grant the SELECT permission to each table for this users. Is there a TSQL statement that will grant the Select permission to each table in a database? The only thing I found was to use the GRANT statement, but I would have to run it on each table. I would like to be able to run 1 statement that will assign SELECT permissions to each table in the database.

Thanks,

Philip Talavera
System Administrator
SVG Distribution

View 4 Replies View Related

Granting Permissions In MS SQL

Jan 18, 2005

Hi all,
I've got a MS SQL database and I created a user using this code:

EXEC sp_addlogin 'USERNAME','PASSWORD'
GO
USE DATABASE
GO
EXEC sp_revokedbaccess 'USERNAME'
EXEC sp_grantdbaccess 'USERNAME'
GO

But when I log into the database using the created user and try create a table, I get an permissions denied message.

Thanks in advance

View 1 Replies View Related

Granting Access Permissions

Nov 15, 2006

Hi
I am using SQL Express2005 on my local machine. How do I grant access permissions to ASPNET in order to log onto a database? I have the SQL management studio installed to do this but I can't seem to find the option to grant permissions.
At the moment the access is granted to MYMACHINE_NAMEMY_USER_NAME.
I am using VS2003
Thanks

View 2 Replies View Related

Granting Permissions On Set Of Tables

Jul 20, 2004

I have 500 tables in my Db.In those some tables name starts with abc (abc_emp,abc_dept) and rest of the tables name start with xyz(xyz_emp,xyz_transactions).I wanted to give select,insert,update and delete permissions for an user on the tables which starts with abc.
How can i do that in a much easier and sophisticated way.

Thanks.

View 1 Replies View Related

Granting Permissions To Developers

Jun 18, 2007

Hi Everyone,

Were looking from some feedback, thoughts, comments, suggestions on a permissions issue in our SQL Server 2005 environment. We have a Development (stand-alone server) and Production (activepassive cluster). Both running SP2. We're looking for the best way to manage permissions for the developers without giving them dbo privileges.

As background information, here's a note / response from a developer outlining the permission they need.

-----------------------------------------

"Our team needs enough permissions on DB database to:



Create and modify DB object such as tables, stored procedures, keys, triggers, views, ...

Be able to execute stored procedures and other basic DB objects



One of the issue I had when working on DatabaseA which was never resolved was that I could create tables, but had no rights to modify them once created.

I could modify them via scripts, but not via graphical interface which is a pain.



I think we should have full permissions to dev DB other than to drop DB, and modify system DB settings.

So that we can work within the created DB shell completely."

-----------------------------------------

Previous to supporting the current SQL Server 2005 environment, the developersapp owners had db_owner for their databases. Definitely not a best practice as with 2005 db_owner is ablke to delete databases. Moving away from this, we thought we would scale them back and only grant them the following database roles:

db_datareader

db_datawriter

db_ddladmin

With these roles, they were able to create the tables, views, stored procedures, etc...... but problems arose when they tried to modify the objects they created as well as execute stored procedures. It's going to be a pain to grant permissions on each stored procedure. More of a mystery is allowing them to make design changes within Studio Manager. Given they can already do this using scripts but not the GUI.

So there is an issue with using GUI tools to design the tables.

Here's a thread we found that tries to explain the reason why they can't use the GUI to make design changes.

Even if you have CREATE TABLE permission, there are limitations to the modifications you can make. Remember, as you modify an existing table or design a new one, your work can induce attendant modifications in other tables. For example, if you change the data type of a foreign-key column, the corresponding column in the primary-key table will be automatically modified by the Visual Database Tools. If you do not own the primary-key table, and you are not logged in as the system administrator, database owner, or a user that is a member of the db_owner role, your modification will fail.

When we created the accounts, we assigned the default schema to be 'dbo'. This was thought to simplify administration of the objects. In SQL Server 2000, this was a best practice. Now, in SQL Server 2005, they changed everything with the user schema separation.

So we have a developer (devuser) - created with default schema (dbo). Any object that are being created are owned by dbo. (ie... dbo.table1, dbo.storedproc1, etc..) So dbo owns the objects, not the user.



Does anyone have any ideas? Do we create a new schema and assign permissions? Do we create a new fixed database role for the developers? I'm curious as to how others are assigning permissions to developers on development and production servers.

Thanks,

Rob

View 4 Replies View Related

Granting Insert, Delete Permissions

Sep 15, 2000

When granting INSERT, DELETE permissions, is this done for
the logon-id OR for the user associated with the logon-id?

I know you can do this for roles.

View 2 Replies View Related

Granting Permissions Using SQL 2005 Schema...

Aug 15, 2007

All,

I have been asked to grant a Windows group Full access to all tables under our Sandbox Schema. This will allow these users to do anything to the tables under this Schema.

I created the Windows Group (Sandbox Users), created the login in SQL, created the user in the database that is tied to the Windows group, then ran GRANT CONTROL ON SCHEMA::[Sandbox] TO [Sandbox Users].

I have verified that the users are in the Windows group, but they state that they still can not delete tables under the Sandbox Schema.

Anyone have any ideas?

Thanks,

Justin

View 5 Replies View Related

Execute Permissions On Stored Procedures

Apr 24, 2007

HI,

would like to know how to give execute permissions for all the stored procedures in a database at one shot. please advise.

View 6 Replies View Related

Granting A User Permissions To Create And Drop A Table

Nov 16, 2006

How do I allow a user (or group of users) permission to create/drop a table?

I have found the 'GRANT CREATE TABLE TO username' command, which will (I assume) allow a user to create a table, but how to I allow a user to 'DROP' the created table as well?
'GRANT DROP TABLE TO username' doesn't work?
and I want the users to be able to DROP/DELETE this table (temporary table created just for printing purposes) as well.

thanks

View 3 Replies View Related

Adding Execute Permissions On Stored Procedures

Jul 23, 2005

How can i add Execute permissions on the Stored Procedures under thecreated user permission iusing SQLDMO ?

View 1 Replies View Related

How Do I Give EXECUTE Permissions On Stored Procedures?

Sep 20, 2007

Hey guys,I'm pretty new to SQL configuration, and I need to give EXECUTEpersmissions for one of the SQL user roles. I am running SQL 2005Management Studio Express - free version. I found the list of mystored procedures, but I can not locate any permissions screen. Cansomeone help point me in the right direction? Thanks!

View 7 Replies View Related

Execute Dynamic SQL Stored Proc Without Specifying Table Level Permissions

Sep 17, 2007

I am writing a SQL 2000 stored procedure which uses an €˜EXEC @sqlString€™ statement. The @sqlString is generated at runtime. I want to give as few permissions as possible and currently allow users to access the database tables using only the stored procedures provided. However, with €˜Exec€™ I discover that I need to grant permissions on the actual tables to the users or groups. I would like to avoid this. I would also prefer not having to maintain a separate user with table level permissions and hardcoding the stored procedure with these details.
Is there anyway for me to dynamically generate the required SQL statement within my stored procedure and let SQL know that this stored procedure is allowed to select whatever tables it wants to without having to define permissions on the tables?

View 1 Replies View Related

SQL Server 2012 :: Permissions For Executing Procedure Which Executes Other Procedures?

May 13, 2015

I have a stored procedure which executes about forty other stored procedures in several different databases. All of these other procedures truncate tables and insert new data into those tables selected from still other tables.

I want to run this top-level procedure using an account which can't do anything else.

Is there a simple way to give it all the permissions it needs without empowering it to do anything else?

View 0 Replies View Related

User 'Unknown User' Could Not Execute Stored Procedure - Debugging Stored Procedure Using Visual Studio .net

Sep 13, 2007

Hi all,



I am trying to debug stored procedure using visual studio. I right click on connection and checked 'Allow SQL/CLR debugging' .. the store procedure is not local and is on sql server.



Whenever I tried to right click stored procedure and select step into store procedure> i get following error



"User 'Unknown user' could not execute stored procedure 'master.dbo.sp_enable_sql_debug' on SQL server XXXXX. Click Help for more information"



I am not sure what needs to be done on sql server side



We tried to search for sp_enable_sql_debug but I could not find this stored procedure under master.

Some web page I came accross says that "I must have an administratorial rights to debug" but I am not sure what does that mean?



Please advise..

Thank You

View 3 Replies View Related

Stored Procedure Permissions

Oct 6, 1999

I have revoked an update stored procedure permission to a SQL user. The first time the user tries to execute the stored procedure he gets the error "Execute permission denied." But if he attempts it a second time the stored procedure will execute with success. I want to deny the user EXEC on the stored procedure forever. Does anybody have any advice to make this happen with success? Thanks.

View 1 Replies View Related

Stored Procedure Permissions?

Jun 7, 2002

I have created a Stored Procedure that will not insert into a particular table.
Yet, when I run the same code in Query Analyzer it runs as it should and completes the Insert.

I have tried to both recreate the SP and searched for authorization issues, with no luck.

Any suggestions?

View 1 Replies View Related

Stored Procedure Permissions

Jun 12, 2008

What role does a user have to be in to execute a stored procedure?

I am trying to run an exec statement from a web app and am getting "The EXECUTE permission was denied".

Thanks.

View 3 Replies View Related

Permissions On A New Stored Procedure

May 4, 2006

Help!

I usually use SQL 2000 at work but upon deciding to work from home have installed and setup SQL express 2005. I use the management studio to write table and sps but for new sp I cannot find how to allow permission. I have been able to allow permission for all sps on the database I restored that I am now working on and have successfully allocated permissions to a new table but cannot do the same with the sp. The sp is viewable in the database but permission is denied when attempting to execute via my ASP script.

Any ideas??

 

Error Type:
Microsoft SQL Native Client (0x80040E09)
EXECUTE permission denied on object 'procBannerSlotList', database 'HotLizardWebsite', schema 'dbo'.

View 1 Replies View Related

Permissions With Dynamic SQL Within Stored Procedure

Aug 1, 2006

Okay, I have sort of a peculiar permissions question I am wondering if someone can help me with. Basically, here's the scenario...
I have a CLR stored procedure which does some dynamic SQL building based on values sent in via XML. It's a CLR stored procedure using XML because I want to build a parameterized statement (to guard against SQL Injection) based on a flexible number of parameters which are basically passed in the XML.
The dynamic SQL ends up reading from a table I'll call TableX and I actually discovered an (understandable) quirk with security.
Basically, the connection context is using security for a low-privilaged Windows account ("UserX") and UserX has no permission to the table referenced in the dynamic SQL but because of the dyanmic nature of the query, the stored procedure ends up adopting the security context of UserX. Naturally, this throws a security exception saying UserX has no SELECT permission on TableX.
Now, I can give UserX read permission to the table in question to get things running, but one of the points of using stored procedures is to defer security to the procedure level vs. configuration for tables or columns.
So in striving toward my ideal of security at the procedure level, my question is what is the best way to allow minimum privilege in this case?
I thought about having the internals of the CLR stored procedure run under a different (low-privalaged) security context, but I am wondering if there's an alternate configuration that may be as secure, but simpler.
PS - Please don't let this degenerate into a conversation about OR mappers. I know that happens a lot on these forums.
 

View 3 Replies View Related

Setting Permissions In A Stored Procedure

Mar 14, 2007

I am using SQL 2000 with the Server Enterprise and the Query Analyzer programs.  Almost everytime I create a new Stored Procedure, I forget to go into Server Enterprise and grant Execute permissions to my users. 
 Is there any way in a Stored Procedure to set the permissions when the Procedure is created?

View 4 Replies View Related

Stored Procedure Permissions Issue

Jan 16, 2002

Hi,

I am testing a method for users to only have the ability to execute only stored procedures that return data and not be able to execute procs that modify data. For testing purposes I have created a 'select' procedure and an 'insert' procedure. I created a user with db_datareader and execute permissions on the two procs and I was still able to execute the 'insert' proc as this user. I also attempted to deny insert permissions on the referenced table to no avail.

Short of establishing a role and granting execute permission to the appropriate procedures, is there a simpler way to do this?

Thank You

Michael

View 1 Replies View Related

Permissions To Create A Stored Procedure

Apr 30, 2008

A simple one (not for me)

MS SQL Server 2005

Which permissions do I need to have (as a User) to create a Stored Procedure
Which other entity's properties do I need to change in order to create a Stored Procedure

Thanks

View 2 Replies View Related

Stored Procedure Permissions List

Nov 29, 2007

Hi All,

For listing login details we have sp_helplogins 'LOGIN NAME'

In the same way i want ti know for particular procedure.

can any one help in this.

Thanks in advance.
malathi

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved