Andy,
sysdtspackages isn't a system table in the same sense as system tables within master and model. Your can define triggers on them. Try the following for logging the activities to the SQL error log.
CREATE TRIGGER tr_sysdtspackages
ON msdb.dbo.sysdtspackages
FOR DELETE, INSERT, UPDATE
AS
BEGIN
DECLARE @msg VARCHAR(500)
DECLARE mods CURSOR FOR
SELECT
CASE
WHEN inserted.name IS NULL THEN 'Delete'
WHEN deleted.name IS NULL THEN 'Insert'
ELSE 'Update'
END
+ ' action on package '
+ COALESCE(inserted.name, deleted.name)
+ ' by ' + SUSER_SNAME()
+ ' (id=' + CONVERT(VARCHAR(50), COALESCE(inserted.id, deleted.id))
+ ',versionid=' + CONVERT(VARCHAR(50), COALESCE(inserted.versionid, deleted.versionid))
+ ')'
FROM
inserted FULL OUTER JOIN deleted
ON inserted.id=deleted.id AND inserted.versionid=deleted.versionid
OPEN mods
WHILE 1=1 BEGIN
FETCH NEXT FROM mods INTO @msg
IF @@FETCH_STATUS <> 0 BREAK
RAISERROR ('%s', 0, 1, @msg) WITH LOG
END
CLOSE mods
DEALLOCATE mods
END
Cheers,
- Mark