DisableTriggers

I am using v.3.3.9.14, and the DisableTriggers option doesn't seem to have any effect.

It should generate script to disable triggers before INSERTs, DELETEs and UPDATEs and re-enable them again afterwards but no script is generated.

Like this:

ALTER TABLE [dbo].[<table name>] DISABLE TRIGGER ALL

DELETE FROM [dbo].[<table name>] WHERE (...)
UPDATE [dbo].[<table name>] SET (...)=(...), (...)=(...) WHERE (...)
INSERT INTO [dbo].[<table name>] (...) VALUES (...)

ALTER TABLE [dbo].[<table name>] ENABLE TRIGGER ALL

Comments

  • Hi Troels

    You are correct, although the syntax is slightly different.

    If you have any triggers defined on you tables, with the option checked, they will be disabled. The script will then read.

    ALTER TABLE [dbo].[<table name>] DISABLE TRIGGER [<trigger name 1>]
    ALTER TABLE [dbo].[<table name>] DISABLE TRIGGER [<trigger name 2>]

    DELETE FROM [dbo].[<table name>] WHERE (...)
    UPDATE [dbo].[<table name>] SET (...)=(...), (...)=(...) WHERE (...)
    INSERT INTO [dbo].[<table name>] (...) VALUES (...)

    ALTER TABLE [dbo].[<table name>] ENABLE TRIGGER [<trigger name 1>]
    ALTER TABLE [dbo].[<table name>] ENABLE TRIGGER [<trigger name 2>]

    If you do not see these commands in the script then please email us at support@red-gate.com and we will help you find out why.

    Regards
    Dan
    Daniel Handley
    Red Gate Software Ltd
This discussion has been closed.