Showing posts with label writes. Show all posts
Showing posts with label writes. Show all posts

Wednesday, March 7, 2012

DDL Trigger and drop table causes error

I have a DDL Trigger that writes a record into a table when any DDL event happens.

It works great except when I try dropping any object. I get an error at that point and the object is not dropped. The trigger and error are listed below.

Thanks.

J

Trigger:

/****** Object: DdlTrigger [MonitorDBChanges] Script Date: 07/24/2007 11:02:02 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TRIGGER [MonitorDBChanges]

ON DATABASE

FOR DDL_DATABASE_LEVEL_EVENTS

AS

set nocount on

declare @.EventType varchar(100)

declare @.SchemaName varchar(100)

declare @.ObjectName varchar(100)

declare @.ObjectType varchar(100)

declare @.Script varchar(2000)

SELECT

@.EventType = EVENTDATA().value('(/EVENT_INSTANCE/EventType)[1]','nvarchar(max)')

,@.SchemaName = EVENTDATA().value('(/EVENT_INSTANCE/SchemaName)[1]','nvarchar(max)')

,@.ObjectName = EVENTDATA().value('(/EVENT_INSTANCE/ObjectName)[1]','nvarchar(max)')

,@.ObjectType = EVENTDATA().value('(/EVENT_INSTANCE/ObjectType)[1]','nvarchar(max)')

,@.Script = EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]','nvarchar(max)')

-- Is the default schema used

if @.SchemaName = ' ' select @.SchemaName = default_schema_name from sys.sysusers u join sys.database_principals p

on u.uid = p.principal_id where u.name = CURRENT_USER

insert into MonitorDBChanges

select @.EventType, @.SchemaName, @.ObjectName, @.ObjectType, getdate(), SUSER_SNAME(), CURRENT_USER, ORIGINAL_LOGIN(),@.Script

GO

SET ANSI_NULLS OFF

GO

SET QUOTED_IDENTIFIER OFF

GO

ENABLE TRIGGER [MonitorDBChanges] ON DATABASE

*******************************************************************************

Error Msg:

SELECT 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. (Microsoft SQL Server, Error: 1934)

Have you tried placing SET ARITHABORT ON along with the ANSI_NULLS and QUOTED_IDENTIFIER options?

WesleyB

Visit my SQL Server weblog @. http://dis4ea.blogspot.com

|||Tried that but I am going to give it another try.|||

Confirmed. No difference

Any other ideas?

Tuesday, February 14, 2012

dbForums->Database Server Software

Who writes those intros?

DB2 (http://www.dbforums.com/f8) (10 Viewing)
DB2 is IBM's offering to the highend database market. The latest version of DB2 (Universal Database) is ideal for OLTP, Data Warehousing, Decision Support and everything in between. It's well priced, extremely scalable and runs on virtually every platform out there from handhelds to mainframes.

vs.

Microsoft SQL Server (http://www.dbforums.com/f7) (31 Viewing)
SQL Server is Microsoft's entry to the database server market. SQL Server is very easy to manage and comes with a built in OLAP engine. It has good support for web enabled applications and other Microsft products. SQL Server only runs on the Windows platform.Well, IBMers need something to do w/ their time... How long before they sell DB2 to a Chinese company? I doubt there are any technology restrictions on that. :D