We have created a DDL trigger on SQL server 2005 database for DB audit purpose. Following is the script used for trigger creation*************************************USE [master]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[ChangeLog]( [LogId] [int] IDENTITY(1,1) NOT NULL, [DatabaseName] [varchar](256) NOT NULL, [EventType] [varchar](50) NOT NULL, [ObjectName] [varchar](256) NOT NULL, [ObjectType] [varchar](25) NOT NULL, [SqlCommand] [varchar](max) NOT NULL, [EventDate] [datetime] NOT NULL CONSTRAINT [DF_EventsLog_EventDate] DEFAULT (getdate()), [LoginName] [varchar](256) NOT NULL) ON [PRIMARY]GOSET ANSI_PADDING OFFSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE trigger [Audit_Trigger]on databasefor DDL_DATABASE_LEVEL_EVENTSASset nocount ondeclare @data xmlset @data = EVENTDATA()insert into MASTER.dbo.changelog(databasename, eventtype, objectname, objecttype, sqlcommand, loginname)values(@data.value('(/EVENT_INSTANCE/DatabaseName)[1]', 'varchar(256)'),@data.value('(/EVENT_INSTANCE/EventType)[1]', 'varchar(50)'), @data.value('(/EVENT_INSTANCE/ObjectName)[1]', 'varchar(256)'), @data.value('(/EVENT_INSTANCE/ObjectType)[1]', 'varchar(25)'), @data.value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'varchar(max)'), @data.value('(/EVENT_INSTANCE/LoginName)[1]', 'varchar(256)'))GOSET ANSI_NULLS OFFGOSET QUOTED_IDENTIFIER OFFGOENABLE TRIGGER [Audit_Trigger] ON DATABASE*********************************************************After the DDL trigger creation. Application team started reporting following error while executing a stored procedure. *********************************Error 1:INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.Error2:[Execute SQL Task] Error: Executing the query "exec sp_drop_indexes_EnhLeaseData delete from dbo.leases where vin_num='XXX' and lease_acct_num='XXXX' delete from dbo.leases where vin_num='XXX' and lease_acct_num='080066225' " failed with the following error: "INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.Any idea on what could be the error and how to fix it? Is this caused because of the trigger which we created? Can someone please help on this?
↧