<p>Assuming such a query exists, I would greatly appreciate the help.</p>

<p>I'm trying to develop a permissions script that will grant "select" and "references" permissions on the user tables and views in a database.  My hope is that executing the "grant" commands on each element in such a set will make it easier to keep permissions current when new tables and views are added to the database.</p>

[{'answer_id': 33266, 'author': 'Jas', 'author_id': 777, 'author_profile': 'https://Stackoverflow.com/users/777', 'pm_score': 0, 'selected': False, 'text': "<pre><code>select * from information_schema.tables\nwhere table_type = 'view'\n</code></pre>\n"}, {'answer_id': 33285, 'author': 'SQLMenace', 'author_id': 740, 'author_profile': 'https://Stackoverflow.com/users/740', 'pm_score': 4, 'selected': True, 'text': "<pre><code>select * from information_schema.tables\nWHERE OBJECTPROPERTY(OBJECT_ID(table_name),'IsMSShipped') =0 \n</code></pre>\n\n<p>Will exclude dt_properties and system tables</p>\n\n<p>add </p>\n\n<pre><code>where table_type = 'view' \n</code></pre>\n\n<p>if you just want the view</p>\n"}, {'answer_id': 33302, 'author': 'karlgrz', 'author_id': 318, 'author_profile': 'https://Stackoverflow.com/users/318', 'pm_score': 2, 'selected': False, 'text': '<pre><code>SELECT\n    *\nFROM\n    sysobjects\nWHERE\n    xtype = \'V\' AND\n    type = \'V\' AND\n    category = 0\n</code></pre>\n\n<p>Here is a list of the possible values for <strong>xtype</strong>:</p>\n\n<ul>\n<li>C = CHECK constraint</li>\n<li>D = Default or DEFAULT constraint</li>\n<li>F = FOREIGN KEY constraint</li>\n<li>L = Log</li>\n<li>P = Stored procedure</li>\n<li>PK = PRIMARY KEY constraint (type is K)</li>\n<li>RF = Replication filter stored procedure</li>\n<li>S = System table</li>\n<li>TR = Trigger</li>\n<li>U = User table</li>\n<li>UQ = UNIQUE constraint (type is K)</li>\n<li>V = View</li>\n<li>X = Extended stored procedure</li>\n</ul>\n\n<p>Here are the possible values for <strong>type</strong>:</p>\n\n<ul>\n<li>C = CHECK constraint</li>\n<li>D = Default or DEFAULT constraint</li>\n<li>F = FOREIGN KEY constraint</li>\n<li>FN = Scalar function</li>\n<li>IF = Inlined table-function</li>\n<li>K = PRIMARY KEY or UNIQUE constraint</li>\n<li>L = Log</li>\n<li>P = Stored procedure</li>\n<li>R = Rule</li>\n<li>RF = Replication filter stored procedure</li>\n<li>S = System table</li>\n<li>TF = Table function</li>\n<li>TR = Trigger</li>\n<li>U = User table</li>\n<li>V = View</li>\n<li>X = Extended stored procedure</li>\n</ul>\n\n<p>Finally, the <strong>category</strong> field looks like it groups based on different types of objects. After analyzing the return resultset, the system views look to have a <strong>category</strong> = 2, whereas all of the user views have a <strong>category</strong> = 0. Hope this helps.</p>\n\n<p>For more information, visit <a href="http://msdn.microsoft.com/en-us/library/aa260447(SQL.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa260447(SQL.80).aspx</a></p>\n'}]
['https://Stackoverflow.com/questions/33226', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3475/']