Home All Groups Group Topic Archive Search About

Execute an sp by via a trigger?

Author
8 Jun 2006 11:17 AM
basulasz
Is it possible to execute a stored procedure by a trigger on insert event? If
so, how should i create the trigger? I created as like below but it did not
work;

create trigger tg_sms on SMS
FOR INSERT
AS my_sp

How should i write this?

Author
8 Jun 2006 11:27 AM
Roy Harvey
At the simplest level all that was missing is EXEC before the stored
procedure name.

create trigger tg_sms on SMS
FOR INSERT
AS EXEC my_sp

Roy Harvey
Beacon Falls, CT

On Thu, 8 Jun 2006 04:17:02 -0700, basulasz
<basul***@discussions.microsoft.com> wrote:

Show quote
>Is it possible to execute a stored procedure by a trigger on insert event? If
>so, how should i create the trigger? I created as like below but it did not
>work;
>
>create trigger tg_sms on SMS
>FOR INSERT
>AS my_sp
>
>How should i write this?
Author
8 Jun 2006 11:41 AM
basulasz
thanx Roy...

Show quote
"Roy Harvey" wrote:

> At the simplest level all that was missing is EXEC before the stored
> procedure name.
>
> create trigger tg_sms on SMS
> FOR INSERT
> AS EXEC my_sp
>
> Roy Harvey
> Beacon Falls, CT
>
> On Thu, 8 Jun 2006 04:17:02 -0700, basulasz
> <basul***@discussions.microsoft.com> wrote:
>
> >Is it possible to execute a stored procedure by a trigger on insert event? If
> >so, how should i create the trigger? I created as like below but it did not
> >work;
> >
> >create trigger tg_sms on SMS
> >FOR INSERT
> >AS my_sp
> >
> >How should i write this?
>

AddThis Social Bookmark Button