Group:  Microsoft Access ยป microsoft.public.access.odbcclientsvr
Thread: set arithabort on

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

set arithabort on
Jason <jasonlewis[ at ]hotmail.com> 09.11.2005 12:31:56
Hello,

I've a problem with inserting a record through a form. The recordsource
is a view from sql server.

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?
Re: set arithabort on
Stefan Hoffmann <stefan.hoffmann[ at ]explido.de> 09.11.2005 13:41:04
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.


mfG
--> stefan <--
Re: set arithabort on
Jason <jasonlewis[ at ]hotmail.com> 10.11.2005 09:08:03
Stefan Hoffmann wrote:
[Quoted Text]
> hi Jason,
>
> Jason wrote:
>
>> 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.
>
>
> mfG
> --> stefan <--


Hi Stefan,

How does it look like, i never used a instead of trigger?
Re: set arithabort on
Stefan Hoffmann <stefan.hoffmann[ at ]explido.de> 11.11.2005 10:37:10
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 <--

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net