Wednesday, March 27, 2013

SQL Server 2008 R2 Audit Log Search and CSV Export Issues

SQL Server 2008 R2 Database Audit Logs can be enabled to track selected database, security and related events and changes in several different predefined categories. This is especially useful in Health Care,  Human Capital and Finance Applications.  When exporting SQL Server 2008 R2 Database Change Audit Logs in CSV format in SQL Server Management Studio certain special characters can cause errors when reading the file in MS Excel.

Searching for and removing these characters with a Text Editor, which show up in the command reference column, do not solve the problem for Excel.  A work-around is to import the cleaned file into Lotus Symphony (available for free download from IBM) and then to format the file and then to export in MS Excel 97-2003 format.

Another item of note is that one needs to be sure under Tools/Options in SQL Server Management Studio to increase the default record count viewable in audit logs to higher than 1k to insure that historical log entries will show up on the view panel when using the Start and End Date Filter options.  If this is not done it may appear that there are no records earlier than a recent date when actually many audit entries actually do exist since the default 1k record view count will start from the current date and run backwards not forward from the original historical filtered start date.