hi Jason,
Jason wrote:
[Quoted Text] >>> The view has a computed column. The problem occurs when there is an >>> insert on that view. In my ado-connection i can fix that, but how do >>> i do it when the view is linked through odbc? >> Use an INSTEAD OF TRIGGER on your view. > How does it look like, i never used a instead of trigger?
OH is your friend:
CREATE TABLE BaseTable (PrimaryKey int IDENTITY(1,1), Color nvarchar(10) NOT NULL, Material nvarchar(10) NOT NULL, ComputedCol AS (Color + Material) ) GO
--Create a view that contains all columns from the base table. CREATE VIEW InsteadView AS SELECT PrimaryKey, Color, Material, ComputedCol FROM BaseTable GO
--Create an INSTEAD OF INSERT trigger on the view. CREATE TRIGGER InsteadTrigger on InsteadView INSTEAD OF INSERT AS BEGIN --Build an INSERT statement ignoring inserted.PrimaryKey and --inserted.ComputedCol. INSERT INTO BaseTable SELECT Color, Material FROM inserted END GO
mfG --> stefan <--
|