| PRB: Updating a Database Sysindexes TableID: Q65057 
 | 
An attempt to update sysindexes using a query such as the following,
   update sysindexes
   set dpages = xxx
   where name = 'my_table' Msg 412, Level 16, State 1:
Cannot update more than 1 Sysindexes row at a time
   select * from sysindexes
   where name = 'my_table' Because the sysindexes table contains one row for each clustered index, each nonclustered index, and each table without a clustered index, it is possible for the table to have more than one entry that corresponds to one data object. To protect against inadvertently modifying duplicate values in sysindexes, SQL Server requires that your UPDATE statement include the columns that compose the primary key for the sysindexes table. These columns are ID and INDID.
To perform an update of the dpages value of a table named "my_table", you
must first find the values of ID and INDID for your table by using the
following query:
   select ID, INDID from sysindexes
   where name = 'my_table' 
    0  for a table with no clustered index
    1  for a clustered index
   >1  for a nonclustered index 
   update sysindexes
   set  dpages = xxx
   where    ID = xxx
   and   INDID = x    <--- (either 0 or 1) Additional query words: prodsql
Keywords          : kbprg SSrvServer 
Version           : 4.2
Platform          : OS/2 
Issue type        : Last Reviewed: March 9, 1999