I currently have a query in SQL 2008 that can return me a list of tables for a given database, provided I have View Definition access to them.
select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE from information_schema.Tables
order by TABLE_NAME
The way our database roles are managed, the existing select permissions are nicely configured across roles, and adding the new View Definitions is done as a single schema-viewing role.
Is there a way I can limit this to the tables the current user has select permission on?
DENY VIEW DEFINITION ON YourTable TO someuserto not be able to retrieve a row fromINFORMATION_SCHEMA.TABLES. By default aGRANT SELECTby itself would allow you to view the table params there. – Thomas Stringer Mar 29 '12 at 20:47@TableTypeas an optional parameter with a default ofNULLand the parameter isn't supplied, then that query won't return anything no matter what database user context is being executed under. – Thomas Stringer Mar 29 '12 at 20:54