how to deny user permission to select from a table

  • Hi everyone,

    I want to deny user permission to select from a table. I wrote below code in SQl server and ran it but I got this error:

    "Cannot find the user 'Fateme_Hei', because it does not exist or you do not have permission."

    USE HCTransNZ

    DENY SELECT ON dbo.AdhocSecurity TO Fateme_Hei

    GO

    I'll appreciate for any help.

    Ragards,

    Fateme

  • well, i'm confident you didn't misspell the user, so here is my best guess:

    the user Fateme_Hei is probably already a sysadmin. that LOGIN does not also have to be a USER in the database to get to the objects within.

    you could add Fateme_Hei as a user:

    CREATE USER [Fateme_Hei] FOR LOGIN [Fateme_Hei]

    THEN you could add the deny statment...I'm not sure if that will work, but if it does work it might only annoy that user, who, as a sysadmin, can change the permissions back so he/she has access again.

    Ideally, noone should be a sysadmin, and then your permissions idea would work correctly.

    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!

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

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