Re: Creating a trigger dynamically inside another trigger/stored procedure?

From: Peter Teoh <>
Date: Wed, 13 Feb 2008 15:54:17 -0800 (PST)
Message-ID: <>

On 2月14日, 上午2时43分, Steve Howard <> wrote:

> At startup, why can't you store in a table (or just check on the fly,
> I don't know what your conditions are) the conditions that determine
> what the behavior on shutdown should be? You could then evaluate and
> implement the process rather than recreating the trigger every time
> you open the database.

I like your suggestion, as it is exactly what I am doing now, then I tried to call a stored proc to recreate the trigger, it worked. And then calling stored proc from a trigger, it worked. But calling a stored proc, that recreate the trigger, no matter how deeply embedded the "recreate the trigger" SQL is, within multiple stored proc, it will fail. So there must be something special between executing in a trigger env, vs stored proc env. I think there exists a fundamental technical reason for this - verified through another experiment (altogether different in nature - in new posting later). I hope everyone can share their comments / experiences as well. Received on Wed Feb 13 2008 - 17:54:17 CST

Original text of this message