Pecos Bill (pe********@yahoo.it) writes:
Salve, non riesco a disabilitare un trigger su sqlserver nè da query
analyzer, nè da enterprise manager.
In pratica tal cosa riuscivo a farla in Oracle con TOAD, mentre qui non
riesco.
Mi interessa disattivarlo senza cancellarlo per poi riattivarlo al bisogno
senza rilanciare lo script di creazione.
Grazie a tutti
Ci sono due maniere di fare questo. Il più facile è a usare
ALTER TABLE tbl DISABLE TRIGGER tri. Ma bisogna comprendere che il
trigger è disabiliato per ogni usatori. Il alternativo e usare un
temp tabella, e nel trigger scrivi:
IF object_id('tempdb..#trigger_disabilitato') IS NULL
BEGIN
.. il code del trigger suivi qui.
END
Il tabella non bisogna avere qualche dati, solamente esistere per
disabilitare il trigger.
Hi I need to disable a DB trigger and I'm not able to do this neither with
query analyzer, neither with enterprise manager.
I remeber this job was quite simple using TOAd in Oracle.
I'm interested in making it disabled not delete it, without run creation
script.
There are two ways to do this. The simplest is to use ALTER TABLE tbl
DISABLE TRIGGER tri. But you need to understand that this disables the
triggers for all users. The alternative is to use a temp table as a flag.
The temp table does not need to have any data, only to exist to disable
the trigger.
--
Erland Sommarskog, SQL Server MVP,
so****@algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp