What are the steps necessary to allow a single user login the ability to execute a single stored procedure and nothing else.

Hello,
I have a request to create a user login and restrict that user to only be able to execute a single stored procedure.
Is this possible using only TSQL commands? 
Am i on the right track here?
USE MyDatabase
GO
CREATE LOGIN [mylogin] DEFAULT_DATABASE = [MyDatabase], CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF
GO
CREATE ROLE exec_single_proc_role
GO
exec sp_addrolemember 'exec_single_proc_role', 'mylogin'
GO
CREATE SCHEMA [restricted] AUTHORIZATION mylogin
GO
GRANT EXECUTE ON SCHEMA::restricted TO exec_single_proc_role
GO

Thanks for the reply.
This particular user should need to be able to Alter, Execute, and View the stored procedure as well.
Here is what i ended up with:  Any improvement are appreciated.  Thanks
USE MyDatabase
GO
--DROP SCHEMA
IF EXISTS (SELECT * FROM sys.schemas WHERE name = N'restricted')
DROP SCHEMA [restricted]
GO
--DROP SERVER WIDE LOGIN
IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'MyUserLogin')
DROP LOGIN [MyUserLogin]
GO
--CREATE SERVER WIDE LOGIN
CREATE LOGIN [MyUserLogin] WITH PASSWORD = 0x0100F1CF6792E602EF40DFF55983FDE81A9 HASHED, SID = 0xC33B04EECE59DC4C95BE66ED9B15D13D, DEFAULT_DATABASE = [MyDatabase], CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF
GO
--DROP ROLE
DECLARE @RoleName sysname
set @RoleName = N'exec_single_proc_role'
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = @RoleName AND type = 'R')
Begin
DECLARE @RoleMemberName sysname
DECLARE Member_Cursor CURSOR FOR
select [name]
from sys.database_principals
where principal_id in (
select member_principal_id
from sys.database_role_members
where role_principal_id in (
select principal_id
FROM sys.database_principals where [name] = @RoleName AND type = 'R' ))
OPEN Member_Cursor;
FETCH NEXT FROM Member_Cursor
into @RoleMemberName
WHILE @@FETCH_STATUS = 0
BEGIN
exec sp_droprolemember @rolename=@RoleName, @membername= @RoleMemberName
FETCH NEXT FROM Member_Cursor
into @RoleMemberName
END;
CLOSE Member_Cursor;
DEALLOCATE Member_Cursor;
End
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'exec_single_proc_role' AND type = 'R')
DROP ROLE [exec_single_proc_role]
GO
--DROP USER
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'MyUserLogin')
DROP USER [MyUserLogin]
GO
--CREATE USER AND ASSIGN DEFAULT SCHEMA
CREATE USER [MyUserLogin] FOR LOGIN [MyUserLogin] WITH DEFAULT_SCHEMA=[restricted]
GO
--CREATE SCHEMA
CREATE SCHEMA [restricted] AUTHORIZATION [MyUserLogin]
GO
--CREATE ROLE
CREATE ROLE [exec_single_proc_role] AUTHORIZATION [MyUserLogin]
GO
--ADD ROLE
EXEC sp_addrolemember 'exec_single_proc_role', [MyUserLogin]
GO
GRANT EXECUTE ON SCHEMA::[restricted] TO [exec_single_proc_role]
GO
GRANT EXECUTE ON OBJECT::[dbo].[MyStoredProcedure] TO [MyUserLogin]
GO

Similar Messages

  • I receive a Software Update notice that fails. How do I find out who/what is trying to update? How do I stop its attempt to update? The only response allowed is "OK". When OK is selected the window goes away and nothing else happens.

    About once a month I receive the Software update notice that has failed. How do I find out who/what is trying to update? If I decided I want this update how do I allow it to continue? If I decided I do not want this update how do I stop it and its attempt to update? The only response allowed is "OK". When OK is selected the window goes away and nothing else happens.

    Hi sharkbiscuit79,
    Yes your cabinet 10 on the Crediton exchange has already been installed and linked with a FTTC DSLAM cabinet (making it able to provide FTTC fibre broadband) and has been Accepting FTTC orders since December 2013.  PCP10 (with it's DSLAM cabinet within 100meters of it) is locate on the junction of Commercial Road and the A3072.
    However by the looks of things your are just too far away to obtain a FTTC (VDSL2) connection, meaning FTTC fibre broadband is not available to you.
    Have a look at the Connecting Devon and Somerset Considerations (particularly the last paragraph) - http://www.connectingdevonandsomerset.co.uk/where-when-map-conditions/
    Your best bet is to talk to Connecting Devon and Somerset to see if there are any further plans to get a fibre based service to your area via https://www.connectingdevonandsomerset.co.uk/contact-us/ (as your area may not be inscope of any further deployment). Best give them your full address and landline number too as they can check if you are within a NGA area.
    jac_95 | BT.com Help Site | BT Service Status
    Someone Solved Your Question?
    Please let other members know by clicking on ’Mark as Accepted Solution’
    Try a Search
    See if someone in the community had the same problem and how they got it resolved.

  • What are configuration steps in implementation for make to order?

    please give the steps for normal production also.

    Hi,
    Below is the requested info:
    Make-to-Order (MTO) Production
    Purpose
    The planning strategies explained in this section are designed for the production of a material for a specific individual sales order. In other words, you do not want to produce finished products until you receive a sales order. This means that make-to-order strategies always support a very close customer-vendor relationship, because your sales orders are closely linked to production.
    The same relationship exists between the sales order and production that exists in a make-to-order environment. Make-to-order is also used in the following environments.
    Production using variant configuration
    Assemble-to-order
    Prerequisites
    Choose a make-to-order strategy, if:
    The materials are segregated. In other words, they are uniquely assigned to specific sales orders.
    Costs must be tracked at sales order level and not on material level.
    Make-to-order strategies should always be combined with lot-size key EX (lot-for-lot. Rounding values should not be used. If you maintain rounding values, they have no effect due to the make-to-order properties of these strategies.
    Process Flow:
    There are extensive options that enable you to procure components especially for specific sales order items.
    You may, however, want to use a different planning strategy to procure components without sales orders. This allows you to keep your replenishment lead time to a minimum. You can do this by:
    Planning on the basis of the finished product (see Planning Without Final Assembly (50) or Planning with a Planning Material (60))
    Planning at component level (see Strategies for Planning Components)
    Using consumption-based or Kanban-controlled components
    Customer stock can exist on any BOM level. See Stockkeeping at Different BOM Levels for more information.
    Because production is closely linked to sales orders, this results in a customer section in the stock/requirements list.
    Unplanned goods receipts (such as returns) cannot, as a rule, be used for other sales orders, even if they are in working order, unless they are adapted to meet a customer's needs.
    In the basic make-to-order strategy, Make-to-Order Production (20), no specific product structures are required. This means that it does not matter if the material has a BOM or not. The material can be produced in-house, or it can be procured externally. No planning is involved in this strategy.
    Planning Without Final Assembly (50) and Planning with a Planning Material (60) do require a specific product structure (i.e. a BOM, which means materials are always produced in-house). These planning strategies assume that you want to plan procurement (production or purchasing) of your components by planning the finished products. This means that you need to have a fairly stable demand for your finished products. If, however, you can plan more easily at component level than at finished product level, see Strategies for Planning Components.
    Configuration Settings:
    Create material master by maintaining general item category group- 0001(make to order)
    Availability check - 02
    Transportation Group - 0001
    go to va01 and raise sales order
    item category:TAk
    Schedule line category : cp
    Requirement type KE
    Requirement class 040
    Check TOR and avalability check
    special stock : E
    VOV7
    of TAK
    billing relivence : A
    Pricing :X
    go to mb1c
    maintain stock with a special stock indicator E
    mavement type 61
    Special stock E
    specify sales order number line item number and saveit
    go to VL01N main data
    Go to VF01
    save it
    Thanks
    Ram

  • My autofill stopped working recently.  I looked under preferences and all the necessary boxes are checked.  When I start to fill out a form, the autofill box comes up, but when I click on it, it turns blue and nothing else happens.

    my autofill stopped working recently.  I looked under preferences and all the necessary boxes are checked.  When I start to fill out a form, the autofill box comes up, but when I click on it, it turns blue and nothing else happens.

    Back up all data, then test after each of the following steps that you haven't already tried. Stop when the problem is resolved.
    1. Press the down-arrow key. (Credit to ASC member iNeight.)
    2. Quit and relaunch Safari. Force quit if necessary.
    3. Click in the first field to be filled, and then select
    Edit ▹ AutoFill Form
    from the menu bar. You may have to reload the page in order to do this.
    4.  Select
    Contacts ▹ Preferences ▹ vCard
    and uncheck the box marked
    Enable private me card
    if it's checked.
    5. Select your card in Contacts. Then select
    Card ▹ Make This My Card
    from the menu bar.
    6. In Safari, select
    Safari ▹ Preferences ▹ AutoFill ▹ AutoFill web forms: Using info from my Contacts card
    If the box was already checked, uncheck it and then check it again.
    7. Launch the Keychain Access application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Keychain Access in the icon grid.
    Select the login keychain from the list on the left side of the Keychain Access window. If your default keychain has a different name, select that.
    If the lock icon in the top left corner of the window shows that the keychain is locked, click to unlock it. You'll be prompted for the keychain password, which is the same as your login password, unless you've changed it.
    Right-click or control-click the login entry in the list. From the menu that pops up, select Change Settings for Keychain "login". In the sheet that opens, uncheck both boxes, if not already unchecked.
    From the menu bar, select
    Keychain Access ▹ Preferences ▹ First Aid
    If the box marked Keep login keychain unlocked is not checked, check it.
    Select
    Keychain Access ▹ Keychain First Aid
    from the menu bar and repair the keychain. Quit Keychain Access.
    8. Run Software Update and install any available updates.

  • I have a I Mac 7.1 operating on version 10.5.8.  I have purchased many songs that reside on my PC andf I want to share them with my I Phone 4.  Can you take me through the steps necessary to be able to share and then play these albums on my I phone 4?

    have a I Mac 7.1 operating on version 10.5.8.  I have purchased many songs that reside on my PC andf I want to share them with my I Phone 4.  Can you take me through the steps necessary to be able to share and then play these albums on my I phone 4?

    After you connect the iPhone to your Mac launch iTunes.
    Select the iPhone under Devices left side of the iTunes window.
    Select the Music tab from the menu.
    Make your selections for the songs you want synced the click the Sync button bottom right side of the iTunes window.
    The iPhone user guide will come in handy ...
    http://manuals.info.apple.com/en_US/iPod_touch_iOS4_User_Guide.pdf

  • I'm trying to find an external drive for the MacPro that will allow me to password protect the external drive in case it is taken.  Any suggestions on a very reliable on that is 2TB or a third party software that is compatable with the need I describe?

    I'm trying to find an external drive for the MacPro that will allow me to password protect the external drive in case it is taken.  Any suggestions on a very reliable one that is 2TB or a third party software that is compatable with the need I describe?

    How much of a hurry are you in, and are you considering upgrading to Lion?
    File Vault on Snow Leopard only encrypts home folders you select, and doesn't work well with Time Machine.
    But Lion will have "full disk encryption" of local or external disks.  See File Vault 2 here: http://www.apple.com/macosx/whats-new/features.html

  • I have done the step 1 to 3,but still cannot connect the wireless network?

    i have done the step 1 to 3,but still cannot connect the wireless network?

    Step 1 to 3 of what? Can you elaborate on the issue?

  • HT201269 I followed the steps But I did not get back all the aps?

    I followed the steps But I did not get back all the aps?

    Apps have never been included in the backup of the device.
    Are the apps in the iTunes library on your computer?  iTunes can only sync apps to a device that are in the iTunes library.

  • Hello i have reset my iphone 4 .3.3 and till now not start again i have the apple on the screen and nothing else what i want to do thank you

    Hello i have reset my iphone 4 .3.3 and till now not start again i have the apple on the screen and nothing else what i want to do thank you

    Try resetting the device by pressing the Home and Sleep/Wake button for several seconds, the device should then boot up.

  • I can only start my iBookG4 after deleting preferences. I have to go into single user mode to do so. If I don't go into single user mode, the computer shuts down during boot up. What might be the problem?

    I can only start my iBookG4 after deleting preferences. I have to go into single user mode to do so. If I don't go into single user mode, the computer shuts down during boot up. What might be the problem? How can I fix this?

    I do not have a startup disk. I did try fsck (based on what I learned from your reply-thank you). This failed (fsck); here is the message:
    ** Checking catalog file.
        Invalid key length
    (4, 8198)
    ** Volume check failed.
    /dev/rdisk03 (hfs) EXITED WITH SIGNAL 8.
    I am sure this is an easy fix; I just have no clue how.

  • Update the iPad 2 with new iOS uppgrade, but after the screen only show the apple and nothing else. has been the case since yesterday. have turned off the iPad and turned it on again many times, but still only apple shown. What should I do?

    UPdate the iPad wjith new iOS upgrade that where shown under settings on the iPad, but after I did the upgrade the screen has only shown the apple and I can't get back. This has been the case since yesterday. Have turned off t.he iPad many times, but every timebwkhen Ibturn it on again the screen onöy show the apple icon and nothing else happends. What should I do? Anyone having the same problem and how can this be solved?

    Did you try to connect in recovery mode, explained in this article?
    iOS: Unable to update or restore

  • HT1430 I have reset all my settings and content of my iphone 3GS but for the last 3 hrs I am stuck at the apple logo and after sometimes its getting off and on by itself but what is coming back is the same apple logo and nothing else is happening. pls adv

    I have reset all my settings and content of my iphone 3GS but for the last 3 hrs I am stuck at the apple logo and after sometimes its getting off and on by itself but what is coming back is the same apple logo and nothing else is happening. pls advice.

    Read https://discussions.apple.com/thread/4875757?start=0&tstart

  • Ho to find out what stored procedures and ssis packages are connecting to server(For examle: ss-cube)?

    Hello Experts, 
    Is there any efficient way to see what stored procedures and ssis packages are connecting to server ss-cube?
    Can you please help me to come across.
    Thanks in advance,
    Regards,
    Hari

    Hello Experts, 
    Is there any efficient way to see what stored procedures and ssis packages are connecting
    to server ss-cube?
    Can you please help me to come across.
    Thanks in advance,
    Regards,
    Hari

  • My iPad mini would not connect in order to download an update, I decided to go to original settings, the screen is frozen showing the apple logo and nothing else, it will not respond.

    My new iPad mini would not download an update bnor allow access to app store downloads etc, I decided to revert to original factory settings, the screen is now frozen, showing only the Apple logo in white on a black background, it is now frozen, what can I do?

    Try a Reset...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    If no joy...
    1)  Connect to iTunes on the computer you usually Sync with and Restore
    http://support.apple.com/kb/HT1414
    2)  If necessary Place the Device into Recovery mode...
    http://support.apple.com/kb/ht4097
    Note on Recovery Mode.
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    Make sure you have the Latest Version of iTunes (v11) Installed on your computer
    iTunes free download from www.itunes.com/download

  • I cannot access the internet using firefox. The little toolbar identical (the far upper right in the screen) pops up and nothing else happerns. This has only started very recently and I have not had this problem in the past.

    When I click on the icon for firefox, a little toolbar (the one you see in the top right corner of the screen) pops up and nothing else happens. I'll close it out and retry, with only the same results. I tried Firefox safemode, with the same result. Like there is something blocking me, but I don't know what. It doesn't matter if I've been on the computer for some time or just started up, I cannot access the web thru Firefox. This has only started in the last couple days. Previously, I've never had this problem. I haven't loaded any new programs anytime recently to account for this. I use Norton for my anti virus program which is the newest and had since end of December. I am not happy having to use the windows internet explorer, so would be very happy to get this resolved. Should I uninstall the mozilla program, and then reinstall it?

    "I have an ethernet cable in port 1 on my computer. That is configured manually to access ther office network."
    Do you have a "real" IP address or a private (192.168.x.x, 10.x.x.x, 172.x.x.x) IP address?
    "The wireless router was connected to the company server only for the purpose of getting me online through Airport because I couldn't access it using an ethernet connection"
    Could not access it because their network security blocked you by intent, or had some unknown technical difficulty?
    Unless you are blocked by intent or ommission (if they have to explicitly allow your machine) I can think of no technical reason why your wired connection should not both get you on their network and on the internet in general. You should not need to be dual homed (though dual homing should work as well).
    Please answer the questions above when you can - I think solving the wired LAN issue will be easier if you are not being intentionally blocked.

Maybe you are looking for

  • **SOLUTION** DLLML.exe Fails to load at startup (application error)

    Hello everyone! I purchased the SB X-Fi Fatalty Champion Edition soon after release, and think this is the best card I have ever used to date. Absolutely love it, unbelievable sound. Now a year or two ago I noticed a certain file failing to load when

  • Quicktime won't uninstall and itunes won't open

    Originally I was having problems opening itunes, an error message appeared saying windows has encoutered an error and needs to close. I then tried uninstalled itunes and reinstalling, and I still couldn't open itunes, I then read that it might be rel

  • ITunes library filoe cannot be saved. You do not have enough access priviledges for this operation

    I get this message when I download from the Store. I am an Administrator on my PC. Anybody know how to fix it? "ITunes library file cannot be saved. You do not have enough access priviledges for this operation"

  • Make LIKP-KODAT   from VL02N non editable

    Hi gurus i want to make the field LIKP-KODAT from  transaction VL02N in header data in processing tab. is any way to make this by the spro transaction? is there any way to code this, because it is a subscreen, so i cant loop at screen for acces to th

  • Template must be in the forms directory

    i uploaded a word document to site assets, and took the url and went to the shared documents, advanced settings for shared documents, then tried to change the template url to the one in site assets, i get this error : Invalid template URL. The templa