?
Solved

insufficient key column information for updating or refreshing - with my view, why???????

Posted on 2006-03-24
4
Medium Priority
?
1,121 Views
Last Modified: 2010-08-05
With this view when I try to update it I am having this message: insufficient key column information for updating or refreshing

The table CADUSO  is another view and the table that I want to update is AGENDA_USO_CONEX, Below you can see their structure

CREATE VIEW dbo.AGENDA_CONEXAO_USO
AS
SELECT     dbo.CADUSO.RH_FUNC_NOME, dbo.AGENDA_USO_CONEX.AG_CODUSO, dbo.AGENDA_USO_CONEX.AG_CODCONEX,
                      dbo.AGENDA_CONEXAO.AG_EMPRESA, dbo.AGENDA_USO_CONEX.AG_ID, dbo.AGENDA_CONEXAO.AG_CONEXAO,
                      dbo.AGENDA_CONEXAO.AG_ID AS Expr1, dbo.CADUSO.RH_FUNC_ID
FROM         dbo.AGENDA_USO_CONEX WITH (nolock) LEFT OUTER JOIN
                      dbo.AGENDA_CONEXAO ON dbo.AGENDA_USO_CONEX.AG_CODCONEX = dbo.AGENDA_CONEXAO.AG_ID LEFT OUTER JOIN
                      dbo.CADUSO WITH (nolock) ON dbo.AGENDA_USO_CONEX.AG_CODUSO = dbo.CADUSO.RH_FUNC_ID

-------------------------------------------------------------------

CREATE TABLE [dbo].[AGENDA_CONEXAO] (
      [AG_ID] [int] IDENTITY (1, 1) NOT NULL ,
      [AG_CONEXAO] [varchar] (5000) COLLATE Latin1_General_CI_AS NULL ,
      [AG_EMPRESA] [varchar] (20) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AGENDA_CONEXAO] WITH NOCHECK ADD
      CONSTRAINT [PK_AGENDA_CONEXAO] PRIMARY KEY  CLUSTERED
      (
            [AG_ID]
      )  ON [PRIMARY]



CREATE TABLE [dbo].[AGENDA_USO_CONEX] (
      [AG_ID] [int] IDENTITY (1, 1) NOT NULL ,
      [AG_CODUSO] [int] NULL ,
      [AG_CODCONEX] [int] NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AGENDA_USO_CONEX] WITH NOCHECK ADD
      CONSTRAINT [PK_AGENDA_USO_CONEX] PRIMARY KEY  CLUSTERED
      (
            [AG_ID]
      )  ON [PRIMARY]
GO
0
Comment
Question by:hidrau
4 Comments
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 1500 total points
ID: 16279559
because the view doesn't implement a 1:1 realtionship ...

so update the base table directly.  
0
 
LVL 20

Expert Comment

by:Sirees
ID: 16279600
0
 
LVL 1

Author Comment

by:hidrau
ID: 16279624
I noticed that If I have only one table joined to my main table it works fine. This error is a bug so?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 16280506
>>This error is a bug so?<<
I am afraid not.  See Lowfatspread's response.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question