Microsoft KB Archive/70674

{|
 * width="100%"|

INF: Using FOR BROWSE on a View in SQL Server

 * }

Q70674

-

The information in this article applies to:


 * Microsoft SQL Server Programmer's Toolkit, version 4.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=&quot;smith&quot; WHERE id=10 

Additional query words: DB-Library DB-Lib dblib FOR BROWSE VIEW Windows NT

Keywords : kbprogramming

Issue type :

Technology : kbSQLServSearch kbAudDeveloper kbSQLServPTK420