79614624

Date: 2025-05-09 17:40:15
Score: 2.5
Natty:
Report link

Thanks to everybody who helped me on this.

Within a loop of fn_get_audit_file, decided for the following:

Solution 1:

SELECT @v_Class_type_Desc = Class_type_Desc, @v_Securable_Class_Desc = Securable_Class_Desc

from master.sys.dm_audit_class_type_map

where class_type = @p_class_type;

-- Make Action Name

set @v_Action_Name = (

select name from master.sys.dm_audit_actions

where action_id = @p_action_id

and class_desc = @v_Securable_Class_Desc

);

-- Make Action Name - 2nd

if @v_Action_Name is NULL or @v_Action_Name = ''

begin

set @v_Action_Name = (

select name from master.sys.dm_audit_actions

where action_id = @p_action_id

and class_desc = @v_Class_type_Desc

);

end;

Solution 2:

-- Make Action Name

set @v_Action_Name = (

select distinct(name) from master.sys.dm_audit_actions

where action_id = @p_action_id

);

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @v_Class_type_Desc
  • User mentioned (0): @v_Securable_Class_Desc
  • User mentioned (0): @p_class_type
  • User mentioned (0): @v_Action_Name
  • User mentioned (0): @p_action_id
  • User mentioned (0): @v_Securable_Class_Desc
  • User mentioned (0): @v_Action_Name
  • User mentioned (0): @v_Action_Name
  • User mentioned (0): @v_Action_Name
  • User mentioned (0): @p_action_id
  • User mentioned (0): @v_Class_type_Desc
  • User mentioned (0): @v_Action_Name
  • User mentioned (0): @p_action_id
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: altink