|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, May 28, 2012 2:15 AM
Points: 1,
Visits: 90
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, September 25, 2012 6:19 PM
Points: 3,
Visits: 45
|
|
Hi there,
Another way that I use which I think will do the same thing is:
--Disable all triggers sp_msforeachtable "ALTER TABLE ? Disable TRIGGER all"
Then when your ready to enable them again:
--Enable all triggers sp_msforeachtable "ALTER TABLE ? Enable TRIGGER all"
I've used this plenty of times in SQL2005 and although I haven't tried in 2008 as yet, I expect it will work.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, May 28, 2012 2:15 AM
Points: 1,
Visits: 90
|
|
Thanks Jammie, That will definately work as well in both 2005 and 2008 as the system stored procedure sp_msforeachtable is included in the latest version, and intelli sense actually pick it up, well spotted.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: 2 days ago @ 5:49 AM
Points: 202,
Visits: 1,043
|
|
SELECT 'ALTER TABLE ['+ SC.NAME+'].[' + PB.NAME + '] ENABLE TRIGGER ALL' FROM SYS.TRIGGERS T JOIN SYS.ALL_OBJECTS OB ON OB.OBJECT_ID = T.OBJECT_ID JOIN SYS.ALL_OBJECTS PB ON PB.OBJECT_ID = OB.PARENT_OBJECT_ID JOIN SYS.SCHEMAS SC ON SC.SCHEMA_ID = PB.SCHEMA_ID
is this will be enough ? or even efficient?
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Thursday, March 14, 2013 4:15 AM
Points: 3,240,
Visits: 4,960
|
|
sp_msforeachtable is a better option. sp_msforeachDb is another useful procedure.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sometimes, winning is not an issue but trying. You can check my BLOG here
|
|
|
|