I implemented audit in SQL Server 2019. Also I have created a job to save audit records from file to a table.According the microsoft document column class_type is NOT NULL
. so in my table is NOT NULL
too. But today my job failed with the following error message:
Cannot insert the value NULL into column 'class_type',
First of all I think this is my fault and the query has problem.Then I discovered that really the function sys.fn_get_audit_file
returns NULL for three statement that are GRANT PERMISSION
.
Although I can filter these three transaction to continue saving audit record. But this conflict between Microsoft documentation and actual data makes me anxious.
Edit:Additional information is that the execution of these statements completed with errors. Because the object names were incorrect.