sp_iqview procedure

Function

Displays information about views in a database.

Syntax1

sp_iqview ( [ view_name ],[view_owner ],[view_type ] )

Syntax2

sp_iqview [view_name='viewname' ],
[view_owner='viewowner' ],[view_type='viewtype' ]

Usage

Syntax1 If you do not specify either of the first two parameters, but specify the next parameter in the sequence, you must substitute NULL for the omitted parameter(s). For example, sp_iqview NULL,NULL,SYSTEM and sp_iqview deptview,NULL,'ALL'.

NoteThe view_type value ALL must be enclosed in single quotes in Syntax1.

Syntax2 The parameters can be specified in any order. Be sure to enclose them in single quotes.

Table 9-24 lists the allowed values for the view_type parameter.

Table 9-24: sp_iqview view_type values

view_type value

information displayed

SYSTEM

system views

ALL

user and system views

any other value

user views

Description

Displays information about views in a database. Specifying one of the parameters returns only the views with the specified view name or views that are owned by the specified user. Specifying more than one parameter filters the results by all of the parameters specified. Specifying no parameters returns all user views in a database.

Table 9-25: sp_iqview columns

Column name

Description

view_name

The name of the view

view_owner

The owner of the view

view_def

The view definition as specified in the CREATE VIEW statement

remarks

User comments added with the COMMENT statement

Examples

Example 10

The following variations in syntax both return information about the view deptview:

call sp_iqview('deptview')
sp_iqview view_name='deptview'

view_name

view_owner

view_def

remarks

deptview

DBA

create view DBA.deptview(vdep

(NULL)

Example 11

The following variations in syntax both return all views that are owned by view owner DBA:

sp_iqview NULL,DBA
sp_iqview view_owner='DBA'

view_name

view_owner

view_def

remarks

deptview

DBA

create view DBA.deptview(vdep

(NULL)

empview

DBA

create view DBA.empview(vemp

(NULL)