INF: Using FOR BROWSE on a View in SQL Server

Last reviewed: April 25, 1997
Article 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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.