Previous Thread

7/25/2006 8:01:47 AM    OLE DB: IRowsetChange on an >>unindexed<< view
Hi everyone, 
 
I have a database implementing row-level security with views and 
 
INSTEAD OF triggers. OLE DB (SQL Server 2005, Native Client, C++) can 
 
open a view as if it were a table with read-only access (even 
 
DBPROP_IRowsetFind is supported properly), but requesting 
 
DBPROP_IRowsetChange for IOpenRowset::OpenRowset always fails with 
 
DB_E_ERRORSOCCURRED, DBPROP_IRowsetChange showing status of 
 
DBPROPSTATUS_CONFLICTING. 
 
Docs state that this might happen if "a property is set that conflicts 
 
with the read-only state of a rowset". I presume this is the case, 
 
because the view in question is non-indexed (and it cannot be indexed 
 
due to the fact that its view definition has to include an [image] type 
 
column, and a non-deterministic SQL Server function SUSER_SNAME()). 
 
Question: 
 
Considering the fact that the underlying table has a unique, clustered 
 
index defined just fine, is there a way to "instruct" OLE DB (at the 
 
OLE DB API level, or SQL Server 2005 database level) to use a 
 
particular column as an update reference for DBPROP_IRowsetChange to 
 
become functional (read/write rowset)? 
 
I tried re-creating the view in question with or without SCHEMABINDING 
 
or VIEW_METADATA, but OLE DB refuses to follow the underlying table 
 
index anyway. 
 
Any ideas? Appreciate any pointers. 
 
Gary