Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Audit

Author  Topic 

kiranmurali
Yak Posting Veteran

55 Posts

Posted - 2011-11-09 : 06:11:54
Hi All,

can any one help how to view the results in audit in sql server 2008.

i have used the following querry to view the results but it is throwing error as below:

querry:

DECLARE @filepattern VARCHAR(300)
DECLARE @folder VARCHAR(255)
DECLARE @auditguid VARCHAR(36)
SELECT @auditguid = audit_guid,@folder = log_file_path
FROM sys.server_file_audits WHERE name = 'TESTAudit'

SELECT @filepattern = @folder + '*_' + @auditguid + '*'
SELECT @filepattern

-- view the results
SELECT a.name AS Action,c.class_type_desc AS ObjectType,
f.server_principal_name,f.schema_name,f.OBJECT_NAME,f.statement
FROM fn_get_audit_file(@filepattern,NULL,NULL) AS f
JOIN sys.dm_audit_class_type_map c ON f.class_type = c.class_type
JOIN sys.dm_audit_actions a ON f.action_id = a.action_id
AND c.securable_class_desc = a.class_desc
WHERE f.action_id <> 'AUSC'
ORDER BY event_time DESC,sequence_number


error:
The specified pattern did not return any files or does not represent a valid file share. Verify the pattern parameter and rerun the command.
but i have specified the correct path.

thanks in advance
kiran murali
   

- Advertisement -