Query View Sample Queries
The following sample query demonstrates how to join the query view to another view.
Joining Query and Security Views
The following query lists the query ID, query name, user name, and the instance permissions for the user on the query object. The v_Query view is joined to the v_UserInstancePermNames view by using the QueryID from v_Query and InstanceKey from v_UserInstancePermNames. Because there may be other secured objects with the same value as the InstanceKey (for example, MCM00001 could be a custom query or a package), the query also filters for query objects only by using the WHERE clause and an ObjectKey value of 7.
SELECT Q.QueryID, Q.Name AS QueryName, UIP.UserName, UIP.PermissionName
FROM v_Query Q INNER JOIN v_UserInstancePermNames UIP
ON Q.QueryID = UIP.InstanceKey
WHERE UIP.ObjectKey = 7
ORDER BY Q.Name, UIP.UserName