<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7689485190553498184</id><updated>2011-07-08T09:19:03.990-04:00</updated><category term='ApexSQL Audit'/><title type='text'>Power User Blog</title><subtitle type='html'>Articles about advanced features for advanced users</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://poweruserblog.apexsql.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7689485190553498184/posts/default'/><link rel='alternate' type='text/html' href='http://poweruserblog.apexsql.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Milena Petrovic</name><uri>http://www.blogger.com/profile/06999464593682519818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7689485190553498184.post-838030863354667951</id><published>2009-12-09T16:57:00.054-05:00</published><updated>2010-01-19T14:54:48.891-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ApexSQL Audit'/><title type='text'>Improving the Readability of your Audit data</title><content type='html'>&lt;span&gt;This article describes how to use two of advanced features of ApexSQL Audit - watches and lookups. These features help improve the readability of your audit data by:&lt;br /&gt;&lt;br /&gt;a) Adding fields to your audit data that can be easily recognized by the users viewing your audit reports. For example, you can show the employee name of an audited row even if the employee name wasn't the actual column that was changed&lt;br /&gt;b) Showing a more readable supporting value to an audited field. For example, if you're auditing a store id, showing  "Ajax Health Store" (the store name) is better than showing 5568 (the store id itself).&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="fullpost"&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is a Watch?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A Watch is a field selected to be added to the audit log when another field in a table is changed (inserted, updated, deleted) even if the Watched field, itself, isn't. Multiple Watch fields can be set up for an audited table. Several different Watch fields can be added to a single audited field. And a single Watch field can be associated with multiple audited fields in the same column.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why use Watches?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Watches allow you to add readily recognizable fields to any audit change which is helpful for people looking at reports. For example, no matter the change is in Sales you can see the Store Name for example, even if the Store itself was not changed. This makes audit reports more readable.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to Create a Watch?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Watches are added at the special Watch panel. The Watch panel can be accessed from the View Menu and it is in the same panel group as Field Grid, Row Key, and Lookups. To access it from there, just select the Panel Tab for "Watches".&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To explain it better we'll use one example. Let assume that we have table Sales.SpecialOffer with the following structure:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; DISPLAY: block;"  border="0" alt="" src="http://www.apexsql.com/poweruser/uploaded_images/p1-739495.png" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Now, let assume that we want to audit changes in Discount Percents. This can be easily done by adding this column to audited columns.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; DISPLAY: block; " border="0" alt="" src="http://www.apexsql.com/poweruser/uploaded_images/p2-799302.png" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Every change on this column will be included to report:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; DISPLAY: block; " border="0" alt="" src="http://www.apexsql.com/poweruser/uploaded_images/p3-1-758112.png" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Now we can see that change was made on column DiscountPct and that old value was 10 and now it's 15. But we don't have additional information. We only have key - 2.&lt;br /&gt;&lt;br /&gt;To add more information, we can use watch. So, every time when change happens, we want to beside these information have another one - description to make it more readable. This must be added every time when DiscoundPct is changed.&lt;br /&gt;&lt;br /&gt;We should set Audit Field Name to DiscountPct and Watch Field Name to Description.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; DISPLAY: block; " border="0" alt="" src="http://www.apexsql.com/poweruser/uploaded_images/p4-753985.png" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;To make this working, we must recreate triggers.&lt;br /&gt;&lt;br /&gt;Now, if DiscountPct is changed, we will see that Cup Sale, DVD Sale and Door Handle Sale discount is changed.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p5-1-745014.png" border="0" alt="" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lookup is another very useful possibility. This makes reports even more readable.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;strong&gt;What is a Lookup?&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Lookups are a powerful feature of ApexSQL Audit that allows you to show the Literal, from a related table, along with the Value of a field that was audited. This way a more human readable value can be seen in the audit reports. For example "Ajax Health Store" (the store name) is much better than 5568 (the store id).&lt;br /&gt;&lt;br /&gt;Lookups are associated with the audited field so they will be triggered any time a row is inserted or deleted. They will be triggered if the specific column is changed in an update.&lt;br /&gt;&lt;br /&gt;Using lookups, you can define an ad hoc relationship between columns from different tables. As with watch columns, if no audited columns are affected by the data change, then none of the lookup values are captured either.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why use Lookups&lt;/strong&gt;?&lt;br /&gt;&lt;br /&gt;Lookups provide Human Readable Audit data for reporting purposes. For example, there may be a numeric ID field in a table that was changed but would be meaningless to someone viewing the audit report. By adding a Lookup though, the literal, from the related code table, can be shown in addition to the ID field.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to Create a Lookup?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Lookups are added at the special Lookups panel. The Lookups panel can be accessed from the View Menu and it is in the same panel group as Field Grid, Row Key, and Watches. To access it from there, just select the Panel Tab for "Lookups".&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;strong&gt;Example&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;To explain it better, let's see another simple example.&lt;br /&gt;Let assume that we have two tables Person.Person and Person.EmailAddress and they are connected via foreign key:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p6-783151.png" border="0" alt="" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Now, let say we want to audit all newly added Email Addresses. This is easy to achieve. We only need to set insert trigger to Person.EmailAddress table.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p7-1-709919.png" border="0" alt="" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;If we add new email address, report will contain:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p8-1-761320.png" border="0" alt="" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Also, we want to know real user name which is bound this email. We will achieve this by using lookups:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p9-711697.png" border="0" alt="" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;And, after recreating triggers, every new mail will be shown like this:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p10-1-763971.png" border="0" alt="" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;But, there is more space for improvements. You can combine field into custom expression, so if you want to see full name with First and Last name, you can do this as follows:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p11-706303.png" border="0" alt="" /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;And report will contain full name like this:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;" src="http://www.apexsql.com/poweruser/uploaded_images/p12-1-746976.png" border="0" alt="" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7689485190553498184-838030863354667951?l=poweruserblog.apexsql.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://poweruserblog.apexsql.com/feeds/838030863354667951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://poweruserblog.apexsql.com/2009/12/watches-and-lookups.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7689485190553498184/posts/default/838030863354667951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7689485190553498184/posts/default/838030863354667951'/><link rel='alternate' type='text/html' href='http://poweruserblog.apexsql.com/2009/12/watches-and-lookups.html' title='Improving the Readability of your Audit data'/><author><name>Milic Vuletic</name><uri>http://www.blogger.com/profile/02510236168090097384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
