Home All Groups Group Topic Archive Search About

Copy triggers between databases without copying table

Author
23 Jun 2006 1:13 PM
SMC
Is there any way to copy a trigger between SQL Server databases without
copying the table?  In other words, is there some what to apply a
trigger to a table through a script?

Author
23 Jun 2006 1:22 PM
Tracy McKibben
SMC wrote:
> Is there any way to copy a trigger between SQL Server databases without
> copying the table?  In other words, is there some what to apply a
> trigger to a table through a script?
>

Just dump the trigger to a script file on one server, then run that
script on the second server.  You should be creating your triggers using
script in the first place, and archiving those scripts off into some
version control software.
Author
23 Jun 2006 2:51 PM
SMC
Tracy,

Thanks for the response!

I do write all my triggers as a script, but how do you "run that script
on the second server"?  Is there a link that could show me how to do
this?

Shane

Tracy McKibben wrote:
Show quote
> SMC wrote:
> > Is there any way to copy a trigger between SQL Server databases without
> > copying the table?  In other words, is there some what to apply a
> > trigger to a table through a script?
> >
>
> Just dump the trigger to a script file on one server, then run that
> script on the second server.  You should be creating your triggers using
> script in the first place, and archiving those scripts off into some
> version control software.
Author
23 Jun 2006 2:58 PM
SMC
I figured it out.  I can just run it in Query Analyzer.

Thanks for all the help!

SMC wrote:
Show quote
> Tracy,
>
> Thanks for the response!
>
> I do write all my triggers as a script, but how do you "run that script
> on the second server"?  Is there a link that could show me how to do
> this?
>
> Shane
>
> Tracy McKibben wrote:
> > SMC wrote:
> > > Is there any way to copy a trigger between SQL Server databases without
> > > copying the table?  In other words, is there some what to apply a
> > > trigger to a table through a script?
> > >
> >
> > Just dump the trigger to a script file on one server, then run that
> > script on the second server.  You should be creating your triggers using
> > script in the first place, and archiving those scripts off into some
> > version control software.
Author
23 Jun 2006 3:02 PM
Tracy McKibben
SMC wrote:
> Tracy,
>
> Thanks for the response!
>
> I do write all my triggers as a script, but how do you "run that script
> on the second server"?  Is there a link that could show me how to do
> this?
>

Same way you run them on your first server - connect with Query
Analyzer, select the proper database, and run the CREATE TRIGGER script.
Author
23 Jun 2006 1:51 PM
joeydj
script the triggers
--
thanks,

------------------------------------
joey


Show quote
"SMC" wrote:

> Is there any way to copy a trigger between SQL Server databases without
> copying the table?  In other words, is there some what to apply a
> trigger to a table through a script?
>
>

AddThis Social Bookmark Button