Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: SQL Server Views Are Read-Only When Linked


View products that this article applies to.

This article was previously published under Q209569
Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access database (.mdb).

↑ Back to the top


Symptoms

When you create queries based on linked tables, the queries are read-only and cannot be updated.

↑ Back to the top


Cause

This behavior occurs because there is no unique index (key field) set in the linked table.

Microsoft SQL Server supports views that can be updated. Microsoft Access can only link these views as read-only because SQL Server views do not have indexes. Microsoft Access requires a unique index on the linked object for update/delete/insert capability.

↑ Back to the top


Resolution

You can either redefine the table to give it a unique index, or you can create a unique index by using a data-definition query.

For example, you can run the following Access data-definition query:
CREATE UNIQUE INDEX index1 ON SeptemberOrders (OrderID)
It is run on a linked view named SeptemberOrders that returns a subset of the remote Orders table and has a unique field named OrderID.

↑ Back to the top


More information

Steps to Reproduce Behavior

To create a read-only view on a linked table, you must be using Windows 98 or Windows NT 4.0 with a version of Microsoft Data Access Components earlier than MDAC 2.5. Follow these steps:
1.Start Microsoft Access and open the sample database Northwinds.mdb.
2.On the File menu, click Get External Data, and link to the Authors table in the Pubs database.
3.Create a query based on that linked table without specifying a unique index.
4.Open the view in Datasheet view and attempt to change data in any record.

Notice that the query is read-only and that Access will not allow you to update the data.

↑ Back to the top


References

For additional information about Microsoft Access and updating linked SQL Servertables, click the article numbers below to view the articles in the Microsoft Knowledge Base:
209807 ACC2000: Remote ODBC Tables Are Read-Only Without a Unique Index
209123 ACC2000: Creating Virtual Indexes w/ SQL Data-Definition Queries

↑ Back to the top


Keywords: KB209569, kbusage, kbworkflowdesigner, kbprb

↑ Back to the top

Article Info
Article ID : 209569
Revision : 3
Created on : 7/14/2004
Published on : 7/14/2004
Exists online : False
Views : 310