Customize DB Role

  • Hi,

    I want create one database customize role, that role should able to do only fetching the data from SQL view (rest of objects should not able to visible) in respective database.

    Please provide scripts for customize DB role.

    Thanks in advance.

    Pradeep.

    Pradeep

  • it's trivially ewasy, but the most important thing is to make sure noone has sysadmin rights; you cannot hide or deny access to a sysadmin.

    sql is deny by default, so if permissions to an object (table/view/proc/etc) not given to someone, they cannot see or access the objects.

    USE [SandBox] --my db for users to do stuff.

    CREATE ROLE [OneViewForYou]

    --give my new role READ permission to one specific view

    GRANT SELECT ON dbo.MyView TO [OneViewForYou]

    --finally, add our user bob to the role we created

    EXEC sp_addrolemember N'OneViewForYou', N'bob'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks.

    Pradeep

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply