You must Sign In to post a response.
  • Category: SQL Server

    Restrict select access on view

    Hi,
    I have a DB view and I want to restrict select access for some users?
    Please let me know how to do this and how can test it to make sure it work?

    Thanks...
  • #762471
    Hi

    Go to Sql server -> Login -> select user -> right click -> Properties then you can put security option.

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762474
    Hello Pramod,

    I am agreed with Mr. Kumar's answer.

    You can also go through reference of MSDN Library :

    https://msdn.microsoft.com/en-us/library/ms173724.aspx

    https://msdn.microsoft.com/en-us/library/ms188338.aspx

    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762492
    Hi

    You can make only particular user to access particular view.
    First create a new user and grant permission for the view he should see, like below

    create login newlogin with password = 'newuser'
    go

    use sridhar //database name
    go

    create user user1 for login newlogin
    go

    grant select on empdetails to user1
    go

    If the user login with id= newlogin and password=newuser then he can see the view under views folder.

    Now create another login user like below with out grant for view.

    create login newlogin2 with password = 'newuser1'
    go

    use sridhar //database name
    go

    create user user2 for login newlogin2
    go

    If user login with id=newlogin2 and password=newuser1 then he cannot see the view under views folder.

    Sridhar Thota.
    Editor: DNS Forum.

    Delete Attachment


Sign In to post your comments