INF: Using FOR BROWSE on a View in SQL Server

ID Number: Q70674

1.10 1.11 4.20

OS/2

Summary:

To use the FOR BROWSE clause properly on a view, the original base

table(s) must have a unique index and a timestamp field. The timestamp

field must be part of the original create statement for the table(s)

involved.

More Information:

There are two ways to invoke the FOR BROWSE clause when using views:

- Have the FOR BROWSE clause attached to the creation statement of

the view, and then select the information from the view.

The following SQL statements illustrate this method:

CREATE VIEW booview1 AS

SELECT * FROM boo

FOR BROWSE

SELECT * FROM booview1

-or-

- Create the view normally without the FOR BROWSE clause. This

approach is demonstrated in the following statement:

CREATE VIEW booview2 AS

SELECT * FROM boo

In this case, the SELECT statement will contain the FOR BROWSE

statement. For example:

SELECT * FROM booview2

FOR BROWSE

All updates must then be made on the base table, not the view:

SELECT * FROM booview2 FOR BROWSE

...

UPDATE boo SET name="smith" WHERE id=10

Additional reference words: DB-LIBRARY db-lib dblib FOR BROWSE VIEW

1.10 1.11 4.20