Assuming such a query exists, I would greatly appreciate the help.
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.
select * from information_schema.tables
WHERE OBJECTPROPERTY(OBJECT_ID(table_name),'IsMSShipped') =0
Will exclude dt_properties and system tables
add
where table_type = 'view'
if you just want the view
SELECT
*
FROM
sysobjects
WHERE
xtype = 'V' AND
type = 'V' AND
category = 0
Here is a list of the possible values for xtype:
Here are the possible values for type:
Finally, the category field looks like it groups based on different types of objects. After analyzing the return resultset, the system views look to have a category = 2, whereas all of the user views have a category = 0. Hope this helps.
For more information, visit http://msdn.microsoft.com/en-us/library/aa260447(SQL.80).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With