GRANT syntax for domain\user

后端 未结 2 369
盖世英雄少女心
盖世英雄少女心 2021-01-17 07:32

I\'m trying to give access to an active directory user to only one specific table. I want them to be able to insert, update, delete, etc. but only for that table. I know thi

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-17 08:03

    Assuming you have created a user in this database associated with the AD login, e.g.

    CREATE LOGIN [domain\user] FROM WINDOWS;
    GO
    USE your_database;
    GO
    CREATE USER [domain\user] FROM LOGIN [domain\user];
    GO
    

    Then you merely have to follow the same syntax. Because \ is not a standard character for an identifier, you need to escape the name with [square brackets]:

    GRANT SELECT, INSERT, UPDATE, DELETE ON dbo.Tablename TO [domain\user];
    

提交回复
热议问题