I am trying to do something seemingly simple, but the research I have done on it hasn’t proven helpful.
The ask: To capture at bare minimum DELETE queries to a table, called 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 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.