INF: Using FOR BROWSE on a View in SQL Server

ID: 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="smith" WHERE id=10
     


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

Keywords : kbprg SSrvDB_Lib SSrvProg SSrvTrans SSrvWinNT
Version : 4.2 | 4.2
Platform : OS/2 WINDOWS
Issue type :


Last Reviewed: March 11, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.