Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I want to copy all of the triggers from one database to another. It's too many tables to trace and copy one by one.Is there a way ?
russell
Pyro-ma-ni-yak
5072 Posts
Posted - 2011-03-21 : 23:49:20
Here's a quick and dirty way that comes to mind...In SSMS, set the output to text. Then execute this:
Declare @trig sysnameDeclare c CursorRead_OnlyFor select name from sys.triggersOpen cFetch Next From c into @trigWHILE @@fetch_status = 0BEGIN EXEC sp_helptext @trig PRINT 'GO' Fetch Next From c into @trigENDClose cDeallocate c