The ask: to capture at bare minimum DELETE
queries to a table dbo.DDLEvents
; my boss would prefer the entire INSERT
and UPDATE
as well, but I think that would cause the table to be too massive.
I have created the table using the following:
CREATE TABLE [dbo].[DDLEvents]
(
[EventDate] [datetime] NOT NULL,
[EventType] [nvarchar](64) NULL,
[EventDDL] [nvarchar](max) NULL,
[EventXML] [xml] NULL,
[DatabaseName] [nvarchar](255) NULL,
[SchemaName] [nvarchar](255) NULL,
[ObjectName] [nvarchar](255) NULL,
[HostName] [varchar](64) NULL,
[IPAddress] [varchar](48) NULL,
[ProgramName] [nvarchar](255) NULL,
[LoginName] [nvarchar](255) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[DDLEvents]
ADD DEFAULT (GETDATE()) FOR [EventDate]
GO
But I’m unsure where to go after this. Pardon my ignorance, as I am still learning DBA role. I’m not even sure this is the table I want/need.
1