sp_StandardCDC_disable_db.sql

Mar 14, 2012 at 5:03 PM

There was an error when this was ran, the database trigger needs to be disabled first

the code now looks like this

BEGIN TRY
		BEGIN TRANSACTION        
			--Remove ddl trigger
			IF EXISTS(SELECT 1 FROM sys.triggers WHERE name = 'trSCDC_ddl_event') DISABLE TRIGGER [trSCDC_ddl_event] ON DATABASE
			IF  EXISTS (SELECT * FROM sys.triggers WHERE parent_class_desc = 'DATABASE' AND name = N'trSCDC_ddl_event')DROP TRIGGER [trSCDC_ddl_event] ON DATABASE
		    
			--Remove DDL tracking table
			IF OBJECT_ID('scdc.ddl_history', 'U') IS NOT NULL
			DROP TABLE scdc.ddl_history;