SQL 2008 - Impossibile disabilitare trigger recursivi

martedì 30 agosto 2011 - 16.25
Tag Elenco Tags  SQL Server 2008

Teo Profilo | Junior Member

Ciao a tutti,
mi trovo su un server SQL 2008 WG SP2.

Provo a disablitare recursive rigger con:
DECLARE @Cmd NVARCHAR(128) SET @Cmd = 'ALTER DATABASE [' + DB_NAME() + '] SET RECURSIVE_TRIGGERS OFF' EXEC SP_ExecuteSQL @Cmd GO

Poi vado a verificare le impostazioni avanzate del mio db con:
sp_configure 'show advanced option', '1' RECONFIGURE GO SP_CONFIGURE GO

Pero' trovo il parametro appena impostato ancora su 1:
server trigger recursion 0 1 1 1

Che cosa sbaglio?
Grazie. :)

lbenaglia Profilo | Guru

>Provo a disablitare recursive rigger con:
>
>DECLARE @Cmd NVARCHAR(128)
>SET @Cmd = 'ALTER DATABASE [' + DB_NAME() + '] SET RECURSIVE_TRIGGERS
>OFF'
>EXEC SP_ExecuteSQL @Cmd
>GO

Ciao Teo,

Questo comando disabilita la ricorsione degli AFTER trigger a livello di database.
Dai BOL: Only direct recursive firing of AFTER triggers is not allowed. To also disable indirect recursion of AFTER triggers, set the nested triggers server option to 0 by using sp_configure.

Per maggiori dettagli tra direct ed indirect triggers:
http://msdn.microsoft.com/en-us/library/ms190739.aspx

>Poi vado a verificare le impostazioni avanzate del mio db con:
>
>sp_configure 'show advanced option', '1'
>RECONFIGURE
>GO
>
>SP_CONFIGURE
>GO
>
>
>Pero' trovo il parametro appena impostato ancora su 1:
>server trigger recursion 0 1 1
>1
>
>Che cosa sbaglio?
Questa invece è una configurazione a livello di istanza ed è relativa ai server-level triggers (non ai classici DML trigger a livello di database).

Dai BOL: Use the server trigger recursion option to specify whether to allow server-level triggers to fire recursively. When this option is set to 1 (ON), server-level triggers will be allowed to fire recursively. When set to 0 (OFF), server-level triggers cannot be fired recursively. Only direct recursion is prevented when the server trigger recursion option is set to 0 (OFF). (To disable indirect recursion, set the nested triggers option to 0.) The default value for this option is 1 (ON). The setting takes effect immediately (without a server restart).

>Grazie. :)
Prego.

Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5