M
Murphy
The scenario is as follows:
1) 3 suppliers provide seperate pricelists that are impoted in the db
2) These pricelists are joined into a single view using a union statements
called tmpSuppliers
3) The view from step 2 is joined to the tmpStock table and displayed in a
view called tmpProducts
We are able to add new rows to the tmpStock table via the tmpProducts view
and when the row is written the appropriate cost price etc is displayed,
however we are unable to delete rows from this view with an error being
returned:
"Insufficient key column information for updating or refreshing"
When the tmpProducts view is displayed in an MS Access no editing is
possible at all (add, edit or delete)
Any help would be greatly appreciated...
Murphy
Create Table tmpSupplierA
(SupplierCode Char(3),
Product VarChar(25),
Cost Money)
Create Table tmpSupplierB
(SupplierCode Char(3),
Product VarChar(25),
Cost Money)
Create Table tmpSupplierC
(SupplierCode Char(3),
Product VarChar(25),
Cost Money)
Create Table tmpStock
(StockID INT IDENTITY,
Supplier Char(1),
SupplierCode Char(3),
Price Money)
GO
INSERT INTO tmpSupplierA Values ('MSE','Mouse', 10)
INSERT INTO tmpSupplierB Values ('KYB', 'Keyboard', 15)
INSERT INTO tmpSupplierC Values ('MON', 'Monitor', 100)
INSERT INTO tmpSupplierC Values ('KYB', 'Keyboard', 14)
INSERT INTO tmpStock (Supplier, SupplierCode, Price) Values ('A', 'MSE', 15)
INSERT INTO tmpStock (Supplier, SupplierCode, Price) Values ('B', 'KYB', 20)
INSERT INTO tmpStock (Supplier, SupplierCode, Price) Values ('C', 'MON',
110)
GO
CREATE VIEW tmpSuppliers
AS
SELECT 'A' As Supplier, SupplierCode, Product, Cost From tmpSupplierA
UNION
SELECT 'B'As Supplier, SupplierCode, Product, Cost From tmpSupplierB
UNION
SELECT 'C'As Supplier, SupplierCode, Product, Cost From tmpSupplierC
GO
CREATE VIEW tmpProducts
AS
SELECT tmpStock.StockID, tmpStock.Supplier, tmpStock.SupplierCode,
tmpSuppliers.Product, tmpSuppliers.Cost, tmpStock.Price
FROM tmpStock INNER JOIN tmpSuppliers ON
tmpStock.Supplier=tmpSuppliers.Supplier AND
tmpStock.SupplierCode=tmpSuppliers.SupplierCode
GO
1) 3 suppliers provide seperate pricelists that are impoted in the db
2) These pricelists are joined into a single view using a union statements
called tmpSuppliers
3) The view from step 2 is joined to the tmpStock table and displayed in a
view called tmpProducts
We are able to add new rows to the tmpStock table via the tmpProducts view
and when the row is written the appropriate cost price etc is displayed,
however we are unable to delete rows from this view with an error being
returned:
"Insufficient key column information for updating or refreshing"
When the tmpProducts view is displayed in an MS Access no editing is
possible at all (add, edit or delete)
Any help would be greatly appreciated...
Murphy
Create Table tmpSupplierA
(SupplierCode Char(3),
Product VarChar(25),
Cost Money)
Create Table tmpSupplierB
(SupplierCode Char(3),
Product VarChar(25),
Cost Money)
Create Table tmpSupplierC
(SupplierCode Char(3),
Product VarChar(25),
Cost Money)
Create Table tmpStock
(StockID INT IDENTITY,
Supplier Char(1),
SupplierCode Char(3),
Price Money)
GO
INSERT INTO tmpSupplierA Values ('MSE','Mouse', 10)
INSERT INTO tmpSupplierB Values ('KYB', 'Keyboard', 15)
INSERT INTO tmpSupplierC Values ('MON', 'Monitor', 100)
INSERT INTO tmpSupplierC Values ('KYB', 'Keyboard', 14)
INSERT INTO tmpStock (Supplier, SupplierCode, Price) Values ('A', 'MSE', 15)
INSERT INTO tmpStock (Supplier, SupplierCode, Price) Values ('B', 'KYB', 20)
INSERT INTO tmpStock (Supplier, SupplierCode, Price) Values ('C', 'MON',
110)
GO
CREATE VIEW tmpSuppliers
AS
SELECT 'A' As Supplier, SupplierCode, Product, Cost From tmpSupplierA
UNION
SELECT 'B'As Supplier, SupplierCode, Product, Cost From tmpSupplierB
UNION
SELECT 'C'As Supplier, SupplierCode, Product, Cost From tmpSupplierC
GO
CREATE VIEW tmpProducts
AS
SELECT tmpStock.StockID, tmpStock.Supplier, tmpStock.SupplierCode,
tmpSuppliers.Product, tmpSuppliers.Cost, tmpStock.Price
FROM tmpStock INNER JOIN tmpSuppliers ON
tmpStock.Supplier=tmpSuppliers.Supplier AND
tmpStock.SupplierCode=tmpSuppliers.SupplierCode
GO