Fejlen betyder, at databasen ikke kan identificere, hvilken række der skal ændres i den oprindelige tabel. Måske er det fordi din nøgle (Sid eller Siteid) ikke er med i din select.
Du kan også betragte din select som et view. Spørgsmålet er om dit view er et "Updatable View". (Jeg har inkluderet lidt dokumentation).
Key-Preserved Tables -------------------- The concept of a key-preserved table is fundamental to understanding the restrictions on modifying join views. A table is key preserved if every key of the table can also be a key of the result of the join. So, a key-preserved table has its keys preserved through a join.
Note: It is not necessary that the key or keys of a table be selected for it to be key preserved. It is sufficient that if the key or keys were selected, then they would also be key(s) of the result of the join.
Attention: The key-preserving property of a table does not depend on the actual data in the table. It is, rather, a property of its schema and not of the data in the table. For example, if in the EMP table there was at most one employee in each department, then DEPT.DEPTNO would be unique in the result of a join of EMP and DEPT, but DEPT would still not be a key-preserved table.
CREATE OR REPLACE VIEW emp_dept AS SELECT empno, ename, sal, e.deptno, dname, loc FROM EMP e, DEPT d WHERE e.deptno = d.deptno; In this view, EMP is a key-preserved table, because EMPNO is a key of the EMP table, and also a key of the result of the join. DEPT is not a key-preserved table, because although DEPTNO is a key of the DEPT table, it is not a key of the join.
Any UPDATE, INSERT, or DELETE statement performed on a join view can modify only *** one *** underlying base table.
In general, all modifiable columns of a join view must map to columns of a key-preserved table.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.