dbTalk Databases Forums  

Re: Drop trigger with a trigger

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Re: Drop trigger with a trigger in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Shuchit
 
Posts: n/a

Default Re: Drop trigger with a trigger - 09-01-2010 , 11:05 PM






Quote:
is it possible to drop a trigger with an other trigger or
even the calling trigger drops it selfs on SA 9?

Any hints will be appreciated.

You could try triggering a database event from the trigger that does the
actual drop of the trigger(s); maybe after a brief pause to allow the trigger
to complete execution and cleanup.

Shuchit

Reply With Quote
  #2  
Old   
Krisztián Pintér
 
Posts: n/a

Default Re: Drop trigger with a trigger - 09-02-2010 , 03:14 AM






On Tue, 31 Aug 2010 20:53:54 +0200, <AH> wrote:

Quote:
is it possible to drop a trigger with an other trigger or
even the calling trigger drops it selfs on SA 9?
any sort of dynamic schema change is a bad smell. there must be a
better solution.

without knowing more about the situation, i suggest you keep the
triggers fixed, and inside the triggers, decide if you must do
things or not.

let's have an example. we want to create a run-once trigger. on
some condition, we need to mark a table "sensitive" to changes,
but we need action only once, for the first change. you can set
up a table like trigger_action_needed, with one column table_name
of type varchar(128). then in the trigger, you write

if not exists (select * from trigger_action_needed where table_name =
'this_table') then
return;
end if;
.... do stuff
delete from trigger_action_needed where table_name = 'this_table';

moral of the story: during normal operations, keep the schema fixed,
and rely on data modifications only.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.