DQL provides the keyword
IN DOCUMENT for checking direct membership of a component in a virtual document. Suppose that the virtual document in the book example has the object ID
090000108001193a. The following query retrieves information about all the chapters and the virtual document itself:
SELECT r_object_id, object_name FROM dm_sysobject IN DOCUMENT ID('090000108001193a') WITH ANY r_version_label = 'CURRENT'
If all the descendants in the hierarchy are desired, the keyword
DESCEND can be used after
ID(). Similarly, the
IN ASSMEBLY keyword can be used to examine the snapshot for the virtual document rather than the virtual document itself.
Further, suppose that books are being represented as a custom type
book_doc and stored ...