Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert trigger not firing
Message
From
09/08/2007 09:53:38
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, United States
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01246888
Message ID:
01247002
Views:
23
Hi Christof,

Thanks for the reply. The trigger fires perfectly from Sql Advantage, the Sybase version of Query Analyzer and other inserts from Sybase sp's, etc. It's only from VFP that it doesn't *appear* to fire.

After a lot of experimentation late yesterday, the mystery deepens. It turns out that the trigger *does* fire after all, but with different results for VFP. The trigger, the purpose of which is to enter a record in an audit table for inserts and changes, calls a sp that has the line of code:

IF @Oldvalue != @Newvalue
begin...

In the case of INSERT, the insert trigger passes a NULL as @Oldvalue to the sp. My question now becomes Why does the sp "see" the NULL comparison one way when called by the trigger during an INSERT from VFP vs another way such as an insert from a Sybase sp?

Isn’t this weird? A VFP spt inserts a record that fires a trigger that calls a sp which evaluates a possible NULL comparison differently from another method of inserting a record!

I had the programmer change the comparison to account for possible NULLs and everything is fine now, but what an odd situation.

Thanks again for the reply. I suppose this is just one more of those things that keeps programming from becoming boring.

Gary


>Hi Gary,
>
>> I have a problem with an insert trigger in Sybase. It won't fire with an SPT insert.
>
>Mayb it's disabled. Try:
>
>alter table "table_name" enable trigger "trigger_name"
>
Previous
Reply
Map
View

Click here to load this message in the networking platform