Sql-server – SQL – Best way to limit access to small number of tables

sql serversql-server-2008

I have a login I've created on SQL Server 2008, it's a SQL Server login not using AD. I want to give them access to every table in two databases except the tables that I store login information in for sites and such. This is one table in each database. Ideally, I'd like them to automatically get access to any new tables added to either database without breaking that restriction on those two login info tables.

Best Answer

Just place a DENY ALL on the table for that user. DENYs are always evaluated first, and will override the GRANT off SELECT to the overall schema:

DENY ALL ON [schema].[object] TO {user_name}

There is no reason to move the login table into a separate schema.