Groups | Blog | Home
all groups > sql server programming > september 2003 >

sql server programming : Creating triggers


Dariusz Hoszowski
9/6/2003 6:33:39 PM
Hi,
I wonder how to create trigger (if it is possible) from stored
procedure - my trigger is too long to pass it from my program and i have to
create a trigger for user tables when they are creating them... Any
suggestions ??
Thanks
Dariusz Hoszowski

Jens Süßmeyer
9/6/2003 9:07:46 PM
Yes it would pe possible if you place the TSQL code inside the procedure.

But it is not recommendend, for waht reasons do you want to place the
trigger creation in the procedure ?

Jens Süßmeyer.


<hoszowskid@poludnie.poczta.wroclaw.pl> schrieb im Newsbeitrag
news:OPoqOSJdDHA.1460@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

Dariusz Hoszowski
9/7/2003 11:21:01 AM
Thanks, but ... my name of trigger and table it is place on have to be
dynamically implement to the trigger (for example when i create the table
name TEST then i have to place a trigger on it so i have to make it's name
like TEST_ON_DELETE an table on which it will be placed 'ON TEST'). So my
dynamic trigger creation is for that. Maybe is another way to do that but i
don't know it.

With best regards
Dariusz Hoszowski

U¿ytkownik "Jens Süßmeyer" <jsuessmeyer@[REJECT_SPAM]web.de> napisa³ w
wiadomo¶ci news:O7cvkoKdDHA.2804@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

Erland Sommarskog
9/7/2003 2:47:26 PM
Dariusz Hoszowski (hoszowskid@poludnie.poczta.wroclaw.pl) writes:
[quoted text, click to view]

Obviously you could use dynamic SQL to create both the table and the
trigger dynamically, but tables and triggers are not something you are
supposed to create dynamically. Tables and triggers are supposed to be
part of a data model, that is largely static.

Maybe you could explain the business problem you are trying to solve?


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
Dariusz Hoszowski
9/7/2003 5:55:45 PM

U¿ytkownik "Erland Sommarskog" <sommar@algonet.se> napisa³ w wiadomo¶ci
news:Xns93EFAA89E8B36Yazorman@127.0.0.1...
[quoted text, click to view]

I know that it should be static but here i have implemented database where i
have one business table where documents are approved and from where they
can't be deleted or changed - and other tables - maked when users are adeded
to the system (like temp user tables where they can make any changes to
documents - they are they - there is not so much users in the system so it
should be 10 - 15 user tables). So it's the business

Dariusz Hoszowski
[quoted text, click to view]

AddThis Social Bookmark Button