SQL Server : can you limit access to only one table

后端 未结 7 1935
旧时难觅i
旧时难觅i 2020-12-08 21:10

I think the answer is no but I\'m looking to give someone access to a SQL Server database but I only really want them to have access to one table.

It\'s

相关标签:
7条回答
  • 2020-12-08 22:08

    Yes.

    exec sp_msforeachtable "DENY SELECT ON ? TO [username];"
    GO
    
    GRANT SELECT ON [schemaName].[tableName] to [username]
    Go 
    

    While that works, you would probably be better off managing permissions using roles and AD groups.

    0 讨论(0)
提交回复
热议问题